http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56737
Bug #: 56737 Summary: Bizarre Hollerith edit descriptor errors (valgrind shows uninitialized value in libgfortran) Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: jonathan.h...@stfc.ac.uk Created attachment 29728 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29728 Code to reproduce bug With the code attached I get junk output in a real program. Simplified version below only shows errors under valgrind. Easy workaround by transforming code to modern Fortran that doesn't use the h edit descriptor. Yes, the byzantine subroutine hierarchy and unuser arguments appear to be required to reproduce the bug. Expected test-code behaviour: Should produce valgrind-clean code. Shuold perhaps warn that 'h' edit descriptor is obsolescent/deleted (in F95+). Expected real-code behaviour: Shouldn't produce garbage to output. Thanks, Jonathan. $gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-4ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-4ubuntu1) $gfortran -g -o gfort_bug gfort_bug.f90 && valgrind ./gfort_bug ==8437== Memcheck, a memory error detector ==8437== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==8437== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==8437== Command: ./gfort_bug ==8437== fmt = ( 3(1H ),6h===== ,a 12,i4,6h =====) title1= end of level level = 1 ===== end of level 1 ===== fmt = ( 3(1H ),6h===== ,a 12,i4,6h =====) title1= end of level level = 1 ==8437== Conditional jump or move depends on uninitialised value(s) ==8437== at 0x4F0BB41: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x400B51: __hsl_mc73_single_MOD_level_print (gfort_bug.f90:56) ==8437== by 0x400B93: __hsl_mc73_single_MOD_multilevel_eig (gfort_bug.f90:40) ==8437== by 0x400BB9: __hsl_mc73_single_MOD_fiedler_graph (gfort_bug.f90:33) ==8437== by 0x400BF9: __hsl_mc73_single_MOD_mc73_fiedler (gfort_bug.f90:17) ==8437== by 0x400C27: MAIN__ (gfort_bug.f90:71) ==8437== by 0x400C5D: main (gfort_bug.f90:62) ==8437== ==8437== Conditional jump or move depends on uninitialised value(s) ==8437== at 0x4F0BB1B: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x400B51: __hsl_mc73_single_MOD_level_print (gfort_bug.f90:56) ==8437== by 0x400B93: __hsl_mc73_single_MOD_multilevel_eig (gfort_bug.f90:40) ==8437== by 0x400BB9: __hsl_mc73_single_MOD_fiedler_graph (gfort_bug.f90:33) ==8437== by 0x400BF9: __hsl_mc73_single_MOD_mc73_fiedler (gfort_bug.f90:17) ==8437== by 0x400C27: MAIN__ (gfort_bug.f90:71) ==8437== by 0x400C5D: main (gfort_bug.f90:62) ==8437== ==8437== Syscall param write(buf) points to uninitialised byte(s) ==8437== at 0x522C900: __write_nocancel (syscall-template.S:82) ==8437== by 0x4F0ECEC: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x4F1540E: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x4F0A726: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x4F0B008: _gfortran_st_write_done (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x400B60: __hsl_mc73_single_MOD_level_print (gfort_bug.f90:56) ==8437== by 0x400B93: __hsl_mc73_single_MOD_multilevel_eig (gfort_bug.f90:40) ==8437== by 0x400BB9: __hsl_mc73_single_MOD_fiedler_graph (gfort_bug.f90:33) ==8437== by 0x400BF9: __hsl_mc73_single_MOD_mc73_fiedler (gfort_bug.f90:17) ==8437== by 0x400C27: MAIN__ (gfort_bug.f90:71) ==8437== by 0x400C5D: main (gfort_bug.f90:62) ==8437== Address 0x5c4fc3a is 26 bytes inside a block of size 512 alloc'd ==8437== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==8437== by 0x4E4D488: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x4F1529A: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x4F0E421: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x4E4AB67: ??? (in /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0) ==8437== by 0x400F315: call_init.part.0 (dl-init.c:85) ==8437== by 0x400F3EE: _dl_init (dl-init.c:52) ==8437== by 0x40016F9: ??? (in /lib/x86_64-linux-gnu/ld-2.15.so) ==8437== end of level 1 ====) ==8437== ==8437== HEAP SUMMARY: ==8437== in use at exit: 0 bytes in 0 blocks ==8437== total heap usage: 29 allocs, 29 frees, 24,709 bytes allocated ==8437== ==8437== All heap blocks were freed -- no leaks are possible ==8437== ==8437== For counts of detected and suppressed errors, rerun with: -v ==8437== Use --track-origins=yes to see where uninitialised values come from ==8437== ERROR SUMMARY: 11 errors from 3 contexts (suppressed: 2 from 2)