]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: fix uninitialized read in testcase gfortran.dg/pdt_48.f03
authorHarald Anlauf <anlauf@gmx.de>
Fri, 26 Sep 2025 17:20:39 +0000 (19:20 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Fri, 26 Sep 2025 17:20:39 +0000 (19:20 +0200)
commite6b4908c0402635c05e98bb1add0c4eaac44a02b
treee26b84a54f7ce75133101592ef712346ad2d8bba
parent40d9e9601a1122749b21b98b4c88029b2402ecfc
Fortran: fix uninitialized read in testcase gfortran.dg/pdt_48.f03

Running the testcase using valgrind --leak-check=full --track-origins=yes:

==28585== Conditional jump or move depends on uninitialised value(s)
==28585==    at 0x400E19: MAIN__ (pdt_48.f03:48)
==28585==    by 0x400EDB: main (pdt_48.f03:34)
==28585==  Uninitialised value was created by a heap allocation
==28585==    at 0x4841984: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==28585==    by 0x400975: __pdt_m_MOD_add (pdt_48.f03:30)
==28585==    by 0x400D84: MAIN__ (pdt_48.f03:44)
==28585==    by 0x400EDB: main (pdt_48.f03:34)

The cause was a partial initialization of a vector used in a subsequent
addition.  Initialize the remaining elements of the first vector by zero.

gcc/testsuite/ChangeLog:

* gfortran.dg/pdt_48.f03:
gcc/testsuite/gfortran.dg/pdt_48.f03