From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 708293858430; Fri, 10 May 2024 01:54:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 708293858430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715306098; bh=fTPu769NBd4cuoxdwfKu5A6MISRVj3D7eLF19FC+oU8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=y2vXv3qnLn0acmPBsB+bbYpRmuQahj9v2AvQrFACteo04OgU7ig4PIT8rYR25nX63 ob7/F5kvkKIuspS52nqZ+p3iGHqsIMaYxmrzie4D+Y7NZ4PCmJ7xJ9xF5IeFDrCeYg 7b+/aZ0VRRG6AQEJWDsZev+9DCDK4hV5nxhKRJdc= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/115019] wraparound bug with with -O3 and int128 Date: Fri, 10 May 2024 01:54:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 14.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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=3D115019 --- Comment #3 from Andrew Pinski --- (In reply to Andrew Pinski from comment #2) > /app/example.cpp:36:24: runtime error: negation of > 0x80000000000000000000000000000000 cannot be represented in type '__int12= 8'; > cast to an unsigned type to negate this value to itself Once I fix that with: ``` static char *itoa128(char *buf, __int128_t v) { if (v < 0) { buf =3D utoa128(buf, -(__uint128_t)v); ``` GCC behavior is what you expect.=