From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 322FA3858D20; Sat, 18 May 2024 14:36:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 322FA3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716042969; bh=jfA9jxLtlLyXtsgRYByjQonmERzkOOt7/lapiYA90N8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qze0Yl/6xFxNkIkrjEcM4NN/uBv4/1H4RE1h0z1ExpOuv+XKuORpinU+X3wcsPdvV /qVmSRYOTFDExMbC+ZiQ8BoXyBa4IDDcv3nJJgf+eejxB5sCiry0xl2GiPLpqhcJPU syYAJWIO4U2XXmref5zTvnaFTtHns4+IsNq6HJLQ= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115143] [11/12/13/14/15 Regression] tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:85 Date: Sat, 18 May 2024 14:36:08 +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: 15.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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=3D115143 --- Comment #9 from Andrew Pinski --- here is one that is more correct to show the failure: ``` unsigned __GIMPLE (ssa,startwith("phiopt")) foo (unsigned a, unsigned b) { unsigned j; unsigned _23; unsigned _12; __BB(2): if (a_6(D) > 0u) goto __BB3; else goto __BB4; __BB(3): j_10 =3D __PHI (__BB2: b_7(D)); _23 =3D __MIN (a_6(D), j_10); goto __BB4; __BB(4): _12 =3D __PHI (__BB3: _23, __BB2: 0u); return _12; } ``` But note this does use the canonical form for the comparison; `a > 0u` is t= he non-canonical form of `a !=3D 0u` (for unsigned types). That is why it didn= 't show up before. My patch (r14-3827-g30e6ee074588ba ) fixed the issue with t= he way comparison was doing and exposed this latent bug. It was trying `j_10 >= =3D 1u` before when it should have been doing `j_10 >=3D 0u` and that is the is= sue. THIS only shows up with unsigned types because `j_10 >=3D 0u` is always tr= ue and it needed that to match the constant really. Anyways my patch fixes the issue=