From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5E18B386F82A; Sat, 27 Jun 2020 15:36:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5E18B386F82A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1593272206; bh=KXhfMz78heknJNIQcvyEZsBjnHLBX/0v6VH1c4UNBn4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bKSE1650y7WjOmS8iZltvOELCfQ2Ap/Aiu0h1OZkfgCHYicQmXEv3qiK9CkwmSGKo jO+kNhYciVUlkxyveBtsRlBiv3rINrhLNTtxkyg34WB866ZLC/7S44pVSVmJFPpzk+ NCwLX4MeDljb6NkL/fXQVvCdOxMgpcxNEL4zzie8= From: "law at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95663] static_cast checks for null even when the pointer is dereferenced Date: Sat, 27 Jun 2020 15:36:46 +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-Version: 10.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: 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: Sat, 27 Jun 2020 15:36:46 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95663 --- Comment #13 from Jeffrey A. Law --- Marc, Yes, absolutely. In fact, I think that falls out of the work Martin S is d= oing in this space. Conceptually we're looking to generalize that code so that = we can route more cases where the compiler detects undefined behavior through = the path isolation routines. Within those commonized routines we want to have a knob which selects diffe= rent behavior from the compiler when undefined behavior is detected which could potentially include issuing the RTL equivalent of __builtin_unreachable vs = trap vs warn, but leave the code alone, try to mitigate, etc. Where I think we've differed in the past is what to do with conditional bra= nch upon which the undefined behavior is control dependent upon. As you may remember, the original submission of path isolation would turn that conditi= onal into an unconditional branch to the valid path. That's not correct because there can be observable behavior that occurs on the path from the condition= al, but before the undefined behavior triggers. Having a knob to twiddle *that* may or may not be a good idea.=