http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57192
Bug #: 57192 Summary: [4.9 Regression] miscompilation at -O3 Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: joost.vandevond...@mat.ethz.ch Created attachment 30045 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30045 testcase, reproduce with 'gfortran -g -O3 orbital_pointers.f90 ; valgrind ./a.out' For the attached testcase, recently 4.9 trunk started generating the following error under valgrind: gfortran -g -O3 orbital_pointers.f90 ; valgrind ./a.out ==61245== Invalid write of size 4 ==61245== at 0x400EED: __orbital_pointers_MOD_init_orbital_pointers (orbital_pointers.f90:102) ==61245== by 0x401B71: main (orbital_pointers.f90:214) ==61245== Address 0x4da2ee4 is not stack'd, malloc'd or (recently) free'd when compiled at -O3 . Compiling with 4.8 branch, or 4.9 and -O2 doesn't cause this behavior. It has been reduced from CP2K after observing that CP2K segfaults due to a change made between rev198568 and rev198590 (but I'm not yet 100% sure this testcase is the root cause).