From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13562 invoked by alias); 23 Aug 2012 16:35:02 -0000 Received: (qmail 13267 invoked by uid 22791); 23 Aug 2012 16:34:55 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED 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; Thu, 23 Aug 2012 16:34:42 +0000 From: "francesco.zappa.nardelli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/54149] write introduction incorrect wrt the C11 memory model Date: Thu, 23 Aug 2012 16:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: francesco.zappa.nardelli at gmail dot com 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: In-Reply-To: References: 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: 2012-08/txt/msg01638.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54149 --- Comment #1 from Francesco Zappa Nardelli 2012-08-23 16:34:38 UTC --- Here is another C program that hits a similar write-introduction problem: int g_7, g_372; char func_10 () { for (; g_7 < 0; ++g_7) { } return 0; } void main () { int l_8; lbl_914: (l_8 = g_7) <= func_10 (); if (l_8) if (g_372) { } else goto lbl_914; } The reference trace is: *** unoptimised trace: gcc --param allow-store-data-races=0 8-min.c -o 8-min_unopt g_7 0 4 Init g_372 0 4 Init g_7 0 4 Load g_7 0 4 Load while the optimised trace (requires -O2 or -O3 to be observable) is *** optimised trace: gcc --param allow-store-data-races=0 -O3 8-min.c -o 8-min_opt g_7 0 4 Init g_372 0 4 Init g_372 0 4 Load g_7 0 4 Load g_7 0 4 Store [ gcc version 4.8.0 20120627 (experimental) (GCC) ]