From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2659 invoked by alias); 23 Sep 2012 10:46:18 -0000 Received: (qmail 2615 invoked by uid 48); 23 Sep 2012 10:45:54 -0000 From: "ajmay81 at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54678] New: second call to get_environment_variable gives valgrind warning with 8-byte integers Date: Sun, 23 Sep 2012 10:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ajmay81 at googlemail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg01818.txt.bz2 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