From daceb656be82b179524cb86c8e01249e2b092632 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Fri, 3 May 2019 10:40:06 +0200 Subject: [PATCH] Reduce ADOL-C max_tape_index limit when using GCC --- include/deal.II/differentiation/ad/ad_drivers.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.39.5