From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BCD63858408; Tue, 4 Jan 2022 14:52:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BCD63858408 From: "hubicka at kam dot mff.cuni.cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/103830] [12 Regression] null pointer access optimized away by removing function call at -Og Date: Tue, 04 Jan 2022 14:52:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at kam dot mff.cuni.cz X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2022 14:52:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103830 --- Comment #5 from hubicka at kam dot mff.cuni.cz --- > I think the recent modref change made the function const. >=20 > And no, we shouldn't DSE any volatile store and generally we don't. It's > probably some side-effect of modref that we do. Using -fno-ipa-pure-const > "fixes" this bug with -Og: >=20 > local analysis of void MyClass::call()/1 > NULL memory access; terminating BB > Function is locally const. > callgraph: >=20 > so it's caused by the recent change to mitigate path-isolation damage to > modref. The change indeed assumes that with -fdelete-null-pointer-checks the access to NULL is invalid no matter if it is volatile or normal. I would expect code having exception handlers at address 0 to be always built with -fno-delete-null-pointer-checks. If we want to preserve user defined volaitle NULL, is there way to stick another flag on the memory accesses synthetised by isolate-paths to mark them as OK to be optimized this way?=