From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18436 invoked by alias); 11 Oct 2012 11:59:39 -0000 Received: (qmail 18379 invoked by uid 48); 11 Oct 2012 11:59:15 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/54900] write introduction incorrect wrt the C11 memory model (2) Date: Thu, 11 Oct 2012 11:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org 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: CC 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-10/txt/msg01069.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54900 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org, | |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek 2012-10-11 11:59:14 UTC --- This is ifcvt.c in action. This is the if (!set_b && MEM_P (orig_x)) case where we already do some checks: if (noce_mem_write_may_trap_or_fault_p (orig_x)) return FALSE; and if (!noce_can_store_speculate_p (test_bb, orig_x)) return FALSE; I'd say noce_can_store_speculate_p is buggy, it uses if (memory_modified_in_insn_p (mem, insn)) return true; but memory_modified_in_insn_p is pessimistic, it doesn't tell whether mem is surely set, but whether it might be set. I guess it would need to use note_stores that would just do rtx_equal_p on the addresses or similarly prove it is surely (and unconditionally) written. So even note_stores might not be the right thing, perhaps just looking at single_set SET_DEST. And avoiding inline asm, that doesn't have to store unconditionally.