https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80850
--- Comment #19 from DIL <liakhdi at ornl dot gov> --- On my Ubuntu 16.04, removing STAT= from the allocate() statement does not help unfortunately, but it now crashes via a different path, although for the same reason. I will experiment more to see if I can finally reproduce this problem in a debugger, so far I was unlucky. Interestingly, valgrind passes the DEV version (the one which fails if run standalone), but complains with the OPT version about an uninitialized stack variable. However, further inspecting the function referred to as the origin of an uninitialized stack variable does not really reveal anything. But this explains why -fno-automatic helps. Somehow it seems like an uninitialized field appears on the stack. I will continue digging to see if I can find something useful for you to inspect. Thanks for looking into this issue! Below is the valgrind output from the OPT binary: ==16508== Conditional jump or move depends on uninitialised value(s) ==16508== at 0x41D597: __stsubs_MOD_clone_object (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x424D67: __gfc_base_MOD_contelemconstruct (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x408667: __gfc_vector_MOD_vectorelemconstruct (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x40AC5B: __gfc_vector_MOD_vectoriterappend (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x418ACD: __gfc_graph_MOD_graphiterappendvertex (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x4195B7: __gfc_graph_test_MOD_test_gfc_graph (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x401FB8: MAIN__ (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x40169E: main (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== Uninitialised value was created by a stack allocation ==16508== at 0x4191D4: __gfc_graph_test_MOD_test_gfc_graph (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== ==16508== Conditional jump or move depends on uninitialised value(s) ==16508== at 0x4C2DB3C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16508== by 0x41D5B0: __stsubs_MOD_clone_object (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x424D67: __gfc_base_MOD_contelemconstruct (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x408667: __gfc_vector_MOD_vectorelemconstruct (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x40AC5B: __gfc_vector_MOD_vectoriterappend (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x418ACD: __gfc_graph_MOD_graphiterappendvertex (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x4195B7: __gfc_graph_test_MOD_test_gfc_graph (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x401FB8: MAIN__ (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x40169E: main (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== Uninitialised value was created by a stack allocation ==16508== at 0x4191D4: __gfc_graph_test_MOD_test_gfc_graph (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== ==16508== Conditional jump or move depends on uninitialised value(s) ==16508== at 0x41D597: __stsubs_MOD_clone_object (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x424D67: __gfc_base_MOD_contelemconstruct (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x408667: __gfc_vector_MOD_vectorelemconstruct (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x40AE0D: __gfc_vector_MOD_vectoriterappend (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x418ACD: __gfc_graph_MOD_graphiterappendvertex (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x4195B7: __gfc_graph_test_MOD_test_gfc_graph (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x401FB8: MAIN__ (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== by 0x40169E: main (in /home/div/src/ExaTensor/GFC/test_gfc.x) ==16508== Uninitialised value was created by a stack allocation ==16508== at 0x4191D4: __gfc_graph_test_MOD_test_gfc_graph (in /home/div/src/ExaTensor/GFC/test_gfc.x)