From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 663143870845; Mon, 15 Jun 2020 12:54:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 663143870845 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592225698; bh=EJEGFV3FtjrxTLMhDs2XBUfU8oMQmbBjjykIrnGlRms=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eH7Arf7jKUkrGPW7b9rE5JBhWXqMfT6K5i9HGV3uex0+zpwo/wronQSFe0aLC9I40 u81DrkRzYZxOQ/u3KQ70HTY7dBq455eiM/LBi6xSqQCKuDfRisCHRv01lkV1TeJuAd CEsG1UWMlqQWgmJHcrz8ePTDKA9vp66bUSFx8jqM= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/95663] static_cast checks for null even when the pointer is dereferenced Date: Mon, 15 Jun 2020 12:54:58 +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: redi at gcc dot gnu.org 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: Mon, 15 Jun 2020 12:54:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95663 --- Comment #7 from Jonathan Wakely --- So yes, the static_cast should evaluate to zero, but if it's followed by a dereference then it seems reasonable to expect -fdelete-null-pointer-checks= to optimize away the handling for zero.=