From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 438AD3858C5F; Thu, 18 May 2023 00:13:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 438AD3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684368787; bh=gScACAdbosukV3MiHqvknRxB9eUZlYC7Y1JBYARQ3sk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Di/ZW0Mjw8hvpAexbNtJsRMIbDnaM/SIWa86CZcqq8wjBJNq0vg5dZ5edsTWBxkGy NwCMal37ac4Ut7r1uF7e3yHcbIzZpcvXvb/XDGodWsTXkpPeA2Q40lCLF5rei93ndM CeCUJI3S2GKJv6Xn8+UZFBwkqz1D3flMQSSm20Lk= From: "thiago at kde dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/109896] Missed optimisation: overflow detection in multiplication instructions for operator new Date: Thu, 18 May 2023 00:13:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: thiago at kde dot 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109896 --- Comment #5 from Thiago Macieira --- (In reply to Andrew Pinski from comment #4) > If you are that picky for cycles, these cycles are not going to be a prob= lem > compared to the dynamic allocation that is just about to happen ...... Yeah, I realised that after I posted the reply. If the calculation is successful, we're going to allocate memory and that's neither fast nor determinstic. If it overflows, we're going to unwind the stack, which is ev= en worse. I had only looked at the multiplication and failed to consider what comes after it. So, yeah, do this if it's a low-hanging fruit.=