From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F02F23858C2B; Thu, 20 Apr 2023 21:37:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F02F23858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682026658; bh=5nSRaj05fQvOfa5DXS+qvvvsZ/0G3tBa6REEM2S+2Mo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hazQKNZqbZs8n4DoPpZzVx/Z3orPzGzHGQXPl5/5u5lOm90/MS/tOLgMkmVz/sWt2 HBYQ+jDIeL7jrOkx9MHxgCvedynB7kgb+q4uTXdoG+b6spmENv6AvUJUSBmnnNHITW a2VYL+Gi7RhUPHFpJuJMdnY+DOmgaLtZYn6qNxps= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109578] fail to remove dead code due to division by zero Date: Thu, 20 Apr 2023 21:37:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WONTFIX 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109578 --- Comment #3 from Andrew Pinski --- (In reply to Vincent Lef=C3=A8vre from comment #2) > (In reply to Andrew Pinski from comment #1) > > We don't removing code before undefined behavior ... > > That is GCC does not know that printf does not have side effects. >=20 > Then GCC is incorrect in bug 29968, because it does the division *before* > the printf. Or was a bug which has since been fixed. For sparc GCC 12.2.0 we get: sethi %hi(.LC0), %o0 call puts, 0 or %o0, %lo(.LC0), %o0 ta 5 Anyways maybe the issue with PR 29968 was a scheduling issue which was fixed later on that GCC didn't realize divide could trap.=