http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51218
Bug #: 51218 Summary: [4.7 Regression] Potential optimization bug Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: anl...@gmx.de Hi all, the attached code crashes at runtime with gfortran 4.7 (svn rev. 181390) when compiled with optimization (-O1 and higher). It works when compiled with -O0, with gfortran 4.6 and earlier at any optimization level tested, and a series of other compilers. Can anybody shed some light on this problem? Depending on the active line in the main program, !#################################### ! Either expression leads to a crash: u = sum(xi*wi) + sum(xi*wi) ! u = sum(xi*wi + xi*wi) !#################################### I get a backtrace or a *** glibc detected *** ./a.out: double free or corruption (fasttop): 0x080743a0 * Activating the following print !####################################### !print *, "vector_times_vector: barrier" !####################################### in module mo_dec_matrix makes the crash disappear. Thanks, Harald