From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9D3C3384AB78; Fri, 19 Apr 2024 09:04:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9D3C3384AB78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713517440; bh=LiomS+2BPWK8QpkQFDt7tG+HWQBiHCS7c6Eeoh5p/rI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bqQsrs8bo9dENHcIgWiS8JKR5bRZNzoq1gJ105uHuno65myfwBM2zVmPCnd5ZQn4e xJtgogAe5ckkotjEYJtC606C4SYuJjzXjPUAbJ80dQPVtsXS6fCru+Ky8hpCiJbT0E Rpnez6wAQ0gbgd7+DTIDvQHjVnLTIRtfMCzrXJMA= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions Date: Fri, 19 Apr 2024 09:03:59 +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: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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=3D114779 --- Comment #5 from Jakub Jelinek --- It isn't about side-effects. It is about it having pointer type. If you change your testcase to uintptr_t psfr_int =3D (uintptr_t) psfr; if (! __builtin_constant_p (psfr_int)) .... then it will work. __builtin_constant_p ((uintptr_t) psfr) will not work though, because the folding strips casts and the POINTER_TYPE_P case triggers in that case as w= ell. I am not sure it would be a good idea to change the __builtin_constant_p behavior at this point, a lot of code in the wild might depend on its curre= nt behavior.=