------- Comment #18 from rguenth at gcc dot gnu dot org  2009-01-17 10:57 
-------
Well, I don't know how fortran strings are supposed to work, but for the
80 chars in a C string you need 81 bytes, 1 byte for the terminating null
character.  Also you single-file testcase prints nothing at -O0 for me, the
expected output with optimization.

At -O0 I see loads of

==5461== Conditional jump or move depends on uninitialised value(s)
==5461==    at 0x40D1E7A: (within /usr/lib/libgfortran.so.3.0.0)
==5461==    by 0x40D0921: (within /usr/lib/libgfortran.so.3.0.0)
==5461==    by 0x8048FA6: print2_ (in /tmp/t)
==5461==    by 0x8048A16: printe_ (in /tmp/t)
==5461==    by 0x8048819: MAIN__ (in /tmp/t)
....

==5461== Use of uninitialised value of size 4
==5461==    at 0x41624E6: (within /lib/i686/cmov/libc-2.7.so)
==5461==    by 0x4165C9B: vfprintf (in /lib/i686/cmov/libc-2.7.so)
==5461==    by 0x418B323: vsnprintf (in /lib/i686/cmov/libc-2.7.so)
==5461==    by 0x416D451: snprintf (in /lib/i686/cmov/libc-2.7.so)
==5461==    by 0x40CB189: (within /usr/lib/libgfortran.so.3.0.0)
==5461==    by 0x40D0CBA: (within /usr/lib/libgfortran.so.3.0.0)
==5461==    by 0x8048FA6: print2_ (in /tmp/t)
==5461==    by 0x8048A16: printe_ (in /tmp/t)
==5461==    by 0x8048819: MAIN__ (in /tmp/t)


this is with GFortran 4.3.  With GFortran 4.4 I get output at -O0 but also

==5485== Conditional jump or move depends on uninitialised value(s)
==5485==    at 0x40D1E7A: (within /usr/lib/libgfortran.so.3.0.0)
==5485==    by 0x40D0921: (within /usr/lib/libgfortran.so.3.0.0)
==5485==    by 0x8048FC0: print2_ (in /tmp/t)
==5485==    by 0x80489F7: printe_ (in /tmp/t)
==5485==    by 0x80487FC: MAIN__ (in /tmp/t)
==5485==    by 0x80493F8: main (in /tmp/t)

so I guess this is a problem in the Fortran runtime or the problem is exposed
there.  But I wonder why there is a difference with optimization.


-- 


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

Reply via email to