From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3C5493858C2B; Sun, 10 Dec 2023 23:09:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C5493858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702249793; bh=qFAmPoak8r/HGaC/5g0sF/93MZi/krj3nSncrcIPRHc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZRPVEV7d26PDwzy8j50vqSUoCQnyfQrwBp0d1r0z3HZ3VGRA1uXM2X/8uupKNfdzQ aLo63+oNVMfJIsJqRoEK7ET+nwRF+3ZKsoiIim15dgW5VZnPZbpBB6TinlREMRlLcq 2ZGKdjDcJP9jTx8dnavrJ+Jw6/OhrSOj6n2D0NKk= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112949] evrp produces incorrect range for __builtin_clz Date: Sun, 10 Dec 2023 23:09:52 +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: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: resolution 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=3D112949 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #4 from Andrew Pinski --- (In reply to Krister Walfridsson from comment #3) > The C program is obviously UB. But the optimization is done on GIMPLE, and > it is not obvious to me that the GIMPLE code is UB -- we have a function > called __builtin_clz that calls an internal function, so they are > different... Not exactly. GCC does not distinguish between __builtin_* the builtin vs an user function really.=20=20 You mention "internal call" but __builtin_clz is not an `internal call` but rather a call to a function decl called __builtin_clz where the decl is a builtin call. That is the call to __builtin_clz is the same decl as the function being defined. There is no undefinedness in the range here since they are exactly the same= .=