From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 876023858D39; Thu, 22 Feb 2024 10:50:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 876023858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708599036; bh=uOeZXfDGvHutpPwZcH7QWfJHR5z0IGZvJ55jyh4zJEo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aRC+F5f4cBHqcPQdAbvQVDT6lP9S00Vq+rcYG8S0w/2F/I2KrrjSTW3bH4jahCECQ l4/Y0khUtSMIQ8IAdJlCZv3vg7rIngLne1CeE5GDtH+uo4p7hFs4CWpTCqZblvW0oN PJU/P3uk9cRp92NHjsJ/8A5DjpKus/4QeYpUZlG4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114032] ifcvt may introduce UB calls to __builtin_clz(0) Date: Thu, 22 Feb 2024 10:50:35 +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: 14.0 X-Bugzilla-Keywords: 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on 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=3D114032 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2024-02-22 Ever confirmed|0 |1 CC| |rguenth at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #2 from Richard Biener --- With other cases the fear is we'd completely unroll and decompose to scalars again and then VRP eventually deriving wrong ranges. So yeah, ifcvt would have to use a .COND_CALL here or some other tricks to avoid the situation - like a .CLZ with the out-of-range behavior specified according to what the target does. OTOH that target behavior might differ between scalar and vector modes (maybe even different vector modes ...). Do we actually treat CLZ (0) as invoking undefined behavior? IIRC we have match patterns that rely on that but conditional on that target hook? IL semantics based on hooks is ... bad. Anyway - did we create a meta-bug to link all these issues together?=