https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80850
Bug ID: 80850 Summary: Sourced allocate() fails to allocate a pointer Product: gcc Version: 5.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran Assignee: unassigned at gcc dot gnu.org Reporter: liakhdi at ornl dot gov Target Milestone: --- Hello, Code repo: https://gitlab.com/DmitryLyakh/GFC Build: Type make. Problem (bug): Please run the binary test_gfc.x 5-10 times (it is quick). On my Ubuntu laptop some (not all) of these identical runs crash with a message from allocate(): "Attempt to allocate an allocated object" This crash happens in gfc_base.F90 line 343. As you will see, the allocate() statement is trying to clone an object via the sourced allocation. The corresponding class(*) pointer "new_el" is explicitly nullified in line 342. Thus, I do not see how I could get the above "Attempt to allocate an allocated object" error. If you change the BUILD_TYPE in Makefile (line 9) from "DEV" to "OPT" (optimized), the problem disappears. New versions of GCC have the same problem (up to 6.3). The Intel and IBM XL compilers pass all tests without any problems. Thanks, Dmitry