From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3ADE2385803E; Wed, 6 Mar 2024 13:37:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3ADE2385803E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709732228; bh=K1qDJmIDHUiM5DiJMqpUkylXqrDjHvnFc71J5QTYu9k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EPrCJu6iRTzUYG/h7P6Zmm1wOo7tV5BJ0N394gtZPac5hm3U32a9/M6J2UBSyS+W5 69N6uMehP5vXfWdVe5a2mBDCVncUELDFNTbUWhUvm8wZ8qO8jXktVlVzm2L6+P1geA hJCBUuNI0Jm4kzIDh54dXw6uRehMZfhRN6RvM3tk= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/105533] UBSAN: gcc/expmed.cc:3272:26: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int' Date: Wed, 06 Mar 2024 13:37:07 +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: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105533 --- Comment #6 from Jakub Jelinek --- Testcase for the first compile time UB (-O3): long long a, b, c; void foo (long long e) { long long d =3D a & 9223372036854775808ULL; c =3D b; if (d && e) c =3D c | d; } Testcase for the second compile time UB (-O2): int a[64]; int p; void foo (void) { int stack_elt =3D 1; while (p) { stack_elt -=3D 11; a[stack_elt] !=3D 0; } }=