From: Jean-Paul Pelteret Date: Fri, 3 May 2019 08:40:06 +0000 (+0200) Subject: Reduce ADOL-C max_tape_index limit when using GCC X-Git-Tag: v9.1.0-rc1~137^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F6982%2Fhead;p=dealii.git Reduce ADOL-C max_tape_index limit when using GCC --- diff --git a/include/deal.II/differentiation/ad/ad_drivers.h b/include/deal.II/differentiation/ad/ad_drivers.h index cdde769459..721e1c0771 100644 --- a/include/deal.II/differentiation/ad/ad_drivers.h +++ b/include/deal.II/differentiation/ad/ad_drivers.h @@ -744,8 +744,17 @@ namespace Differentiation // verification that we cannot use or exceed this value. This value is // defined as TBUFNUM; see // https://gitlab.com/adol-c/adol-c/blob/master/ADOL-C/include/adolc/internal/usrparms.h#L34 +# ifdef __clang__ static const typename Types::tape_index max_tape_index = TBUFNUM; +# else + // For some reason, the test adolc/helper_tape_index_01 indicates that + // ADOL-C does not reliably perform correct computations for the full + // range of tape indices when GCC is the compiler. So we limit this number + // according to the results of the test. + static const typename Types::tape_index max_tape_index = + TBUFNUM - 2; +# endif }; // struct Numbers