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
* [Bug fortran/54678] second call to get_environment_variable gives valgrind warning with 8-byte integers
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 ` burnus at gcc dot gnu.org
2013-01-05 20:55 ` tkoenig at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-09-24 6:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54678
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-09-24 06:37:26 UTC ---
Draft patch:
--- a/libgfortran/intrinsics/env.c
+++ b/libgfortran/intrinsics/env.c
@@ -186,5 +186,6 @@ get_environment_variable_i8 (char *name, char *value,
GFC_INTEGER_8 *length,
get_environment_variable_i4 (name, value, &length4, &status4,
- &trim_name4, name_len, value_len);
+ trim_name ? &trim_name4 : NULL,
+ name_len, value_len);
if (length)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/54678] second call to get_environment_variable gives valgrind warning with 8-byte integers
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
3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-01-05 20:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54678
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-01-05
CC| |tkoenig at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-01-05 20:54:57 UTC ---
Hi Tobias,
do you plan to commit the patch from Comment #1?
It looks obvious to me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/54678] second call to get_environment_variable gives valgrind warning with 8-byte integers
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
3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-06 12:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54678
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-06 12:43:49 UTC ---
Author: burnus
Date: Sun Jan 6 12:43:45 2013
New Revision: 194948
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194948
Log:
2013-01-06 Tobias Burnus <burnus@net-b.de>
PR fortran/54678
* intrinsics/env.c (get_environment_variable_i8): Don't use
uninitialized variable.
Modified:
trunk/libgfortran/ChangeLog
trunk/libgfortran/intrinsics/env.c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/54678] second call to get_environment_variable gives valgrind warning with 8-byte integers
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
` (2 preceding siblings ...)
2013-01-06 12:44 ` burnus at gcc dot gnu.org
@ 2013-01-06 12:46 ` burnus at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-01-06 12:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54678
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-01-06 12:46:16 UTC ---
FIXED on the trunk (4.8).
Thanks for the report - and sorry for the delay.
Thomas: Thanks for the reminder.
^ 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).