From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31134 invoked by alias); 10 Nov 2014 11:21:12 -0000 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 Received: (qmail 31098 invoked by uid 48); 10 Nov 2014 11:21:09 -0000 From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/63803] When GCC 4.9.2 compile with option -O2, the target is error. Date: Mon, 10 Nov 2014 11:21: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-Version: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-11/txt/msg00689.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63803 --- Comment #5 from Marek Polacek --- (In reply to Airbak from comment #3) > 2. > *((unsigned int *)0) is OK > *((volatile unsigned int *)0) is not OK. > Why the "volatile" makes different? Because volatile prevents the compiler from optimizing that statement out. As stated above, dereferencing a NULL pointer is undefined, so if you do that, all bets are off. You can use -fno-isolate-erroneous-paths-dereference, but I think the problem is elsewhere.