http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52176

             Bug #: 52176
           Summary: Valgrind complains about some realloc on assignment to
                    unallocated LHS
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: domi...@lps.ens.fr
                CC: bur...@gcc.gnu.org, pa...@gcc.gnu.org


At revision 184016, the executable for Rouson et al code in
chapter08/puppeteer_f2003 passes valgrind without error up to -O. For higher
optimization, valgrind complains:

==6241== Conditional jump or move depends on uninitialised value(s)
==6241==    at 0x100004E46: MAIN__.2374 (main.F90:95)
==6241==    by 0x10000755E: main (main.F90:27)

this is

      jacobian = identity - 0.5*dt*dRHS_dState

and a lot of

==6153== Conditional jump or move depends on uninitialised value(s)
==6153==    at 0x100005258: __air_module_MOD_coordinate (air.F90:82)
==6153==    by 0x1000070BF: ??? (in ./a.out)
==6153==    by 0x10000728F: ??? (in ./a.out)
==6153==    by 0x1000070BF: ??? (in ./a.out)
==6153==    by 0x100454B8F: ???
==6153==    by 0x1000070BF: ??? (in ./a.out)
==6153==    by 0x208: ???

this is

  ! accessor: returns phase-space coordinates
  function coordinate(this) result(return_x)
    class(air)          ,intent(in)  :: this
    real  ,dimension(:) ,allocatable :: return_x
    return_x = [ this%x ,this%sigma ]
  end function

Adding

    allocate(return_x(2))

fixes the later errors. Note that running the executable outside valgrind seems
to give the right results even with -Ofast -flto.

Reply via email to