From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13359 invoked by alias); 18 Nov 2011 23:07:00 -0000 Received: (qmail 13351 invoked by uid 22791); 18 Nov 2011 23:06:59 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Nov 2011 23:06:45 +0000 From: "anlauf at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51218] New: [4.7 Regression] Potential optimization bug Date: Fri, 18 Nov 2011 23:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gmx dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-11/txt/msg01949.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: anlauf@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