https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66141
Bug ID: 66141 Summary: Invalid code generation with -O1, -O2, -O3 for x86_64 target for array reference in Fortran COMMON Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: george at gly dot bris.ac.uk Target Milestone: --- Created attachment 35540 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35540&action=edit Self-contained program to show buggy functionality Attached short Fortran program functions properly with no optimization or -O0 but not when -O1, -O2, or -O3 used. Code generation for references to storage in Fortran COMMON incorrect. Expected output, when compiled with -O0 or no optimization is: kvalue should be OK but is OK Output when compiled with -O1, -O2, or -O3 is: kvalue should be OK but is UNDEFINE [Program generates warning on compilation, but this is allowed under the semantics of Fortran COMMON (allocated COMMON storage is longest among any of its definition).]