public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54678] New: second call to get_environment_variable gives valgrind warning with 8-byte integers
@ 2012-09-23 10:46 ajmay81 at googlemail dot com
  2012-09-24  6:37 ` [Bug fortran/54678] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ajmay81 at googlemail dot com @ 2012-09-23 10:46 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: ajmay81@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-06 12:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-23 10:46 [Bug fortran/54678] New: second call to get_environment_variable gives valgrind warning with 8-byte integers ajmay81 at googlemail dot com
2012-09-24  6:37 ` [Bug fortran/54678] " burnus at gcc dot gnu.org
2013-01-05 20:55 ` tkoenig at gcc dot gnu.org
2013-01-06 12:44 ` burnus at gcc dot gnu.org
2013-01-06 12:46 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).