https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107874
--- Comment #14 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- Now this is interesting. Compling with -static I get: $ gfc -static merge_1.f90 [jerry@r7laptop merge]$ ./a.out tstuff fstuff T tstuff fstuff F tstuff fstuff T tstuff fstuff F tstuff T tstuff F fstuff T fstuff F So there is something wrong with the linking as it hangs without -static $ echo $LD_LIBRARY_PATH /home/jerry/dev/usr/lib64/:/home/jerry/dev/usr/lib/ $ gfc -v Using built-in specs. COLLECT_GCC=gfc COLLECT_LTO_WRAPPER=/home/jerry/dev/usr/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../trunk/configure --prefix=/home/jerry/dev/usr --enable-languages=c,c++,fortran --enable-libgomp --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221201 (experimental) (GCC) [jerry@r7laptop bin]$ ls -l gfc lrwxrwxrwx. 1 jerry jerry 32 Nov 20 15:50 gfc -> /home/jerry/dev/usr/bin/gfortran Am I doing something wrong? Also Valgrind does show some issues, but one can not be sure.: $ gfc -static merge_1.f90 [jerry@r7laptop merge]$ valgrind --leak-check=full --show-leak-kinds=all ./a.out ==17321== Memcheck, a memory error detector ==17321== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al. ==17321== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info ==17321== Command: ./a.out ==17321== ==17321== Syscall param set_robust_list(head) points to uninitialised byte(s) ==17321== at 0x48848A: __tls_init_tp (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x439361: __libc_setup_tls (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x438630: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== Address 0x40006b0 is in the brk data segment 0x4000000-0x4000d3f ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x460387: malloc (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4B3B9A: _dl_get_origin (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x489416: _dl_non_dynamic_init (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x48ABE8: __libc_init_first (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4386A8: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x460459: malloc (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4B3B9A: _dl_get_origin (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x489416: _dl_non_dynamic_init (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x48ABE8: __libc_init_first (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4386A8: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x45EFBB: _int_malloc (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x45FC34: tcache_init.part.0 (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x460463: malloc (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4B3B9A: _dl_get_origin (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x489416: _dl_non_dynamic_init (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x48ABE8: __libc_init_first (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4386A8: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x4757D4: __strcspn_sse42 (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4B8CFC: strsep (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4AEE1E: fillin_rpath.isra.0 (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4AF52C: _dl_init_paths (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x489A3B: _dl_non_dynamic_init (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x48ABE8: __libc_init_first (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4386A8: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x4757B2: __strcspn_sse42 (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4B8CFC: strsep (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4AEE1E: fillin_rpath.isra.0 (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4AF52C: _dl_init_paths (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x489A3B: _dl_non_dynamic_init (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x48ABE8: __libc_init_first (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4386A8: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== tstuff fstuff T tstuff fstuff F tstuff fstuff T tstuff fstuff F tstuff T tstuff F fstuff T fstuff F ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x45B3D9: __libc_cleanup_push_defer (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x459EA9: _IO_flush_all_lockp (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x45A122: _IO_cleanup (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F40A: __run_exit_handlers (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F4AF: exit (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4370C0: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x45B425: __libc_cleanup_pop_restore (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x45A070: _IO_flush_all_lockp (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x45A122: _IO_cleanup (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F40A: __run_exit_handlers (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F4AF: exit (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4370C0: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x45B3D9: __libc_cleanup_push_defer (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x45A141: _IO_cleanup (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F40A: __run_exit_handlers (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F4AF: exit (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4370C0: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== Conditional jump or move depends on uninitialised value(s) ==17321== at 0x45B425: __libc_cleanup_pop_restore (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x45A2D0: _IO_cleanup (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F40A: __run_exit_handlers (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x43F4AF: exit (in /home/jerry/dev/test/merge/a.out) ==17321== by 0x4370C0: (below main) (in /home/jerry/dev/test/merge/a.out) ==17321== ==17321== ==17321== HEAP SUMMARY: ==17321== in use at exit: 0 bytes in 0 blocks ==17321== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==17321== ==17321== All heap blocks were freed -- no leaks are possible ==17321== ==17321== Use --track-origins=yes to see where uninitialised values come from ==17321== For lists of detected and suppressed errors, rerun with: -s ==17321== ERROR SUMMARY: 10 errors from 10 contexts (suppressed: 0 from 0)