From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 66B7438582BE; Tue, 29 Nov 2022 08:03:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66B7438582BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669709019; bh=3/J3WWHcyl6hYeUDB7JUhG8VwjduQO+5Gdd7Em5Cow4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DqFamRMly0Wlg7msQ3kHP3XnNTx+KCh1ZFCVDz/KUXjkigxXKoogpYI8eGgRsaz2I iqwS2yHxSMzQd7geXdwJycZAtqG8iAqLhOatmTCUzJdR0nSoouAPCWgthtsP8GSCyp Ke5hroCl8XMLvsTjjiUmzZ0iuyXnX973JhGBQzlw= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107898] [11/12/13 Regression] ICE in irange_intersect, at value-range.cc:1640 Date: Tue, 29 Nov 2022 08:03:38 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: cf_reconfirmed_on component everconfirmed cc bug_status 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=3D107898 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-11-29 Component|tree-optimization |c Ever confirmed|0 |1 CC| |aldyh at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener --- Confirmed. (gdb) up #1 0x00000000019f5fed in irange::irange_intersect (this=3D0x7fffffffc500, = r=3D...) at /home/rguenther/src/trunk/gcc/value-range.cc:2559 2559 gcc_checking_assert (undefined_p () || r.undefined_p () (gdb) l 2554 2555 bool 2556 irange::irange_intersect (const irange &r) 2557 { 2558 gcc_checking_assert (!legacy_mode_p () && !r.legacy_mode_p ()); 2559 gcc_checking_assert (undefined_p () || r.undefined_p () 2560 || range_compatible_p (type (), r.type ())); 2561 2562 if (undefined_p ()) 2563 return false; (gdb) p debug (r) [irange] long unsigned int [5001, +INF] $1 =3D void (gdb) p debug (*this) [irange] unsigned int [1, +INF] and we invoke this from #4 0x0000000002bf496d in alloca_call_type (stmt=3D,=20 is_vla=3Dfalse) at /home/rguenther/src/trunk/gcc/gimple-ssa-warn-alloca.cc:228 (gdb) l 223 // The invalid bits are anything outside of [0, MAX_SIZE]. 224 int_range<2> invalid_range (build_int_cst (size_type_node, 0), 225 build_int_cst (size_type_node, max_size), 226 VR_ANTI_RANGE); 227 228 r.intersect (invalid_range); 229 if (r.undefined_p ()) 230 return alloca_type_and_limit (ALLOCA_OK); and the issue is that the argument of the 'alloca' call is of type unsigned int due to the "parsing" error with -fpreprocessed. The C frontend again makes 'alloca' built-in with a mismatched prototype here. I'm not sure why we have to require compatible ranges on intersection of irange though? Since we don't have anti-ranges there's no implicit min/max of types involved here, only symbolics (if they could creep in) would make things difficult. There's if (varying_p ()) { operator=3D (r); return true; } that would require range "conversion" (we don't want to change the type of 'this') and all the ::to_wide would instead require ::to_widest. Anyway, it's easy to "fix" the Walloca pass here. Unfortunately there's no conversion operator or operator> for irange, we just want to ask if (r > max_size) (and have max_size converted to the type of r with saturation).=