From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 95AFB3858D28; Wed, 2 Nov 2022 01:51:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95AFB3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667353916; bh=wAUsYHa5jmHxeliKeCzsFLoTwp1rEKfnJ/VbZpgi1LE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Duu8D4/v7PXu90V2t8iYwEgYzWq8o/4Kkpt+2hfAiJvh2SpJ7OpEmlnZk/5jkR2kw MYlATKieT2Zp9h74K/8ydbHB1Df+W7lFELmtFkf+lspR6SvchRkrEUter1xQPN+FSe nVdigmBmNP1Zz6gFcgTeYQeojjFLs4RoyA8OR4gg= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105532] [11/12/13 Regression] UBSAN: gcc/hwint.h:293:61: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int' Date: Wed, 02 Nov 2022 01:51:54 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed short_desc target_milestone keywords cf_reconfirmed_on bug_status see_also 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=3D105532 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Summary|UBSAN: gcc/hwint.h:293:61: |[11/12/13 Regression] |runtime error: shift |UBSAN: gcc/hwint.h:293:61: |exponent 64 is too large |runtime error: shift |for 64-bit type 'long |exponent 64 is too large |unsigned int' |for 64-bit type 'long | |unsigned int' Target Milestone|--- |11.4 Keywords| |ice-on-valid-code Last reconfirmed| |2022-11-02 Status|UNCONFIRMED |NEW See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=3D96688 --- Comment #2 from Andrew Pinski --- Confirmed. The bug is either in tree_nonzero_bits and should not be doing: return wi::shwi (-1, TYPE_PRECISION (TREE_TYPE (t))); For vector types or is in match.pd where it should not be calling tree_nonzero_bits for vector types. /* ~(X >> Y) -> ~X >> Y if ~X can be simplified. */ (simplify (bit_not (rshift:s @0 @1)) (if (!TYPE_UNSIGNED (TREE_TYPE (@0))) (rshift (bit_not! @0) @1) /* For logical right shifts, this is possible only if @0 doesn't have MSB set and the logical right shift is changed into arithmetic shift. */ (if (!wi::neg_p (tree_nonzero_bits (@0))) (with { tree stype =3D signed_type_for (TREE_TYPE (@0)); } (convert (rshift (bit_not! (convert:stype @0)) @1)))))) I almost want to say we should put an gcc_assert in tree_nonzero_bits for w= hen it gets called with vector or complex types (maybe even real types). The match.pd pattern was added with r11-6663-g8f8762a2e8659c .=