I am a bit inexperienced with Valgrind which reports an uninitialized
variable in my 34,000 line program. But the message comes from a branch
deep in libgfortran. After some experimentation, I created the following
example program which demonstrates my difficulty:
cat -n test.for
1 program test
2 integer i,j
3 j=i+1
4 write(*,*) j
5 stop
6 end
I compile and run with:
gfortran -g stuff.for
valgrind --track-origins=yes ./a.out
and get a great deal of output pointing to line 4. But the first use of
the uninitialized value is in line 3. In this case the error is obvious,
but IRL I haven't been able to identify the source. I thought
"track-origins" would do that. Is there an option or other way to ask
Valgrind to be a little stricter, and flag the use of an unidentified
variable in an assignment, not just in a condition?
Here is the output with --exit-on-first-error=yes, otherwise there is an
avalanch of text:
==4095841== Memcheck, a memory error detector
==4095841== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==4095841== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
==4095841== Command: ./a.out
==4095841==
==4095841== Conditional jump or move depends on uninitialised value(s)
==4095841== at 0x4AD2B8E: ??? (in /usr/lib64/libgfortran.so.5.0.0)
==4095841== by 0x4AD6C6B: ??? (in /usr/lib64/libgfortran.so.5.0.0)
==4095841== by 0x4AD7C66: ??? (in /usr/lib64/libgfortran.so.5.0.0)
==4095841== by 0x4011DC: MAIN__ (test.for:4)
==4095841== by 0x401233: main (test.for:6)
==4095841== Uninitialised value was created by a stack allocation
==4095841== at 0x401176: MAIN__ (test.for:1)
==4095841==
==4095841==
==4095841== Exit program on first error (--exit-on-first-error=yes)
Thank you and any help much appreciated.
Daniel Feenberg
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users