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



             Bug #: 54678

           Summary: second call to get_environment_variable gives valgrind

                    warning with 8-byte integers

    Classification: Unclassified

           Product: gcc

           Version: 4.7.1

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: ajma...@googlemail.com





Seen with this cut-down example (test.f90):



program test

implicit none

character(len=1024) :: a

call get_environment_variable("HOME",a)

write(6,*)'HOME=',trim(a)

call get_environment_variable("HOME",a)

write(6,*)'HOME=',trim(a)

end



Compiling with:



gfortran -g -fdefault-integer-8 test.f90



and running valgrind on the resulting executable gives a warning about an

uninitialized variable on the second call to get_environment_variable:



==13919== Conditional jump or move depends on uninitialised value(s)

==13919==    at 0x4F14DF4: _gfortran_get_environment_variable_i4 (in

/usr/lib64/libgfortran.so.3.0.0)

==13919==    by 0x4F14F62: _gfortran_get_environment_variable_i8 (in

/usr/lib64/libgfortran.so.3.0.0)

==13919==    by 0x4009AC: MAIN__ (test.f90:6)

==13919==    by 0x400AA4: main (test.f90:8)



Compiling with default (4-byte) integers does not show the problem, i.e.:



gfortran -g test.f90

Reply via email to