From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 177EC3858D20; Tue, 31 Oct 2023 13:51:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 177EC3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698760269; bh=PWV2+0SMZrSdUwv1xZD9MFUaijDMaKbur6mbp3wQTgc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=A2k90zRbfhsBHJ/ExTigLfDmsmd94vDzMAJ99a7fDn/wY1hDmWrPZfbJDp9A75+hG s57i3MH7ITvLhlIoAqpa5FL7THo/ZX9bi45OPaMEwul9hcxTWCkf95nFdqO4B2CTTr Qy4FrtKVWmPyNaYjZZsJBGr8CiGg5JjG4f88ng14= From: "rth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112296] __builtin_constant_p doesn't propagate through member functions Date: Tue, 31 Oct 2023 13:51: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: 13.1.0 X-Bugzilla-Keywords: documentation, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth 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=3D112296 --- Comment #7 from Richard Henderson --- (In reply to Richard Biener from comment #5) > int bad1(void) { return __builtin_constant_p(global++); } ... > Joseph, Richard, do you have anything to add or remember discussions about > this semantic detail of __builtin_constant_p? Since it has been 25 years, I don't recall any specific discussions. The intended use-case at the time was more like #define macro(x) \ (__builtin_constant_p(x) \ ? inline_expression(x) \ : out_of_line_function(x)) So I would have expected side effects to have been ignored for the builtin and expanded via one of the two arms.=