kaskr/adcomp

Compiler optimisation issues with R4+ TMB

pjumppanen opened this issue · 2 comments

On compiling a TMB project with full optimisation using RTools40 on Windows 10 with R4.04 I get a host of "undefined behaviour" warning messages associated with TMB cleanup code. In this version the model in question has erratic behaviour not present in the previous release it was used on (R3.62) so it is possible this may be related. Either way, TMB code should be clean compiling without this serious error message.

C:/Users/jum002/Documents/R/R-4.0.4/library/RcppEigen/include/Eigen/src/Core/util/Memory.h:259:17: warning: iteration 1152921504606846976 invokes undefined behavior [-Waggressive-loop-optimizations]
while(size) ptr[--size].~T();

The complete and compilable project is attached.
PTBoB0Targ.zip

kaskr commented

These warnings are annoying but harmless.

If you observe 'erratic behaviour' of a TMB model that used to work with an old R version the problem could be the Matrix package (Versions 1.3-0 to 1.3-2).
Try upgrading TMB to version 1.7.20.

kaskr commented

Fixed with TMB 1.8.0