Hi, 2017-10-26 5:16 GMT+02:00 Peter Dunn <pdu...@usc.edu.au>: > Hi all > > I am trying to compile (on my Mac) an R package (tweedie) which includes > Fortran 77 code. I’m not much of a programmer, but can still manage to write > and update F77 code. I’m new to valgrind. > > In checking my package (which passes the build-and-check with no errors), I > use valgrind like this: > > R -d "valgrind --tool=memcheck --leak-check=full --track-origins=yes" > --vanilla < tweedie-Ex.R > > > …on my package example, which gives me a series of messages like this: > > ==53843== Conditional jump or move depends on uninitialised value(s) > ==53843== at 0x1118F61FB: smallp_ (in > /Users/pdunn2/Library/R/3.4/library/tweedie/libs/tweedie.so) > ==53843== by 0xBFA4FB88FFFFFFEB: ??? > ==53843== by 0x3FF91CB2DA3A50E7: ??? > ==53843== by 0x104888757: ??? > ==53843== by 0xFFFFFFEC03E375AF: ??? > ==53843== by 0x3FE18C2EE1BE47CB: ??? > ==53843== by 0x104885DEF: ??? > ==53843== by 0x104885DF7: ??? > ==53843== by 0x3FE518F314C67BE7: ??? > ==53843== by 0x11364CEAF: ??? > ==53843== by 0x104885DBF: ??? > ==53843== by 0x100000007: ??? (in > /Library/Frameworks/R.framework/Resources/bin/exec/R) > ==53843== Uninitialised value was created by a stack allocation > ==53843== at 0x1118F59A6: smallp_ (in > /Users/pdunn2/Library/R/3.4/library/tweedie/libs/tweedie.so)
CRAN shows a complete backtrace: https://www.stats.ox.ac.uk/pub/bdr/memtests/valgrind/tweedie/tweedie-Ex.Rout According to it, the offending conditional jump seems to be this one: if ( ( its .LT. 3 ) & .OR. & ( ( its .LT. maxit ) .AND. & ( abs(relerr) .GT. aimrerr ) & ) & ) then > I can see the piece of R code in the example from which this comes. The > subroutine smallp is mentioned in the second line of the output. > > I simply cannot find the issue. (Spent days looking so far.) There are only > a few conditional jumps, and everything not passed to the subroutine smallp > is initialised. I have checked the calls to smallp as well. I have compiled > the fortran code separately (after wrapping into a complete program), with > all kinds of flags: > > gfortran -O2 -fimplicit-none -Wall -Wline-truncation > -Wcharacter-truncation -Wsurprising -Waliasing -Wunused-parameter > -fwhole-file -fcheck=all -std=f2008 -pedantic -fbacktrace), Did you try "-O0 -g" instead of "-O2"? Regards, Iñaki ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel