[Patch, Fortran] PR31295 - Fix uninitialized variable
Tobias Burnus
burnus@net-b.de
Tue May 22 16:00:00 GMT 2007
:ADDPATCH fortran:
For "eoshift((/1, 3/), 3)", eoshift0 is called with "which = 1". As the
array has only one dimension,
sstride[0] is never set in the "for (dim = 0; dim < GFC_DESCRIPTOR_RANK
(array); dim++)" loop.
Therefore, "if (sstride[0] == 0)" uses the undefined value.
This patch silences the valgrind error, which should have no affect on
the result. (As Thomas wrote in the PR: "We are doing calculations with
the value, but don't actually use this for anything.")
With the patch, gfortran.dg/zero_sized_1.f90 and gfortran.dg/eoshift.f90
give no valgrind error ("Conditional jump or move depends on
uninitialised") any more.
Ok for the trunk? Build & regression tested on x86_64-unknown-linux-gnu
with no related failures.
Current failures:
- gfortran.fortran-torture/execute/st_function.f90, PR31095
- gfortran.dg/interface_12.f90 and gfortran.dg/result_in_spec_1.f90,
work with -O, fails with -O2 at runtime with:
Fortran runtime error: Attempt to allocate a negative amount of memory.
Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: valgrind-fix.diff
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070522/e1dc93f5/attachment.bin>
More information about the Fortran
mailing list