From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1B94E38582BC; Tue, 31 Oct 2023 16:55:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B94E38582BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698771346; bh=+L0J+U4gBpUWqXtoORD0uAKeUwWKB1AEo83BXKYJhqQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fWrP05+gFD8tc+NZDL76SgzY17mC0ccj1gRIaNOHE2LeP8JMljRmchLciGo1vxMhF u1kz63UsowuKmoD548+2SoWK1iTo6ESrpIIYMrTosJ786D69Sfm/Q3xyVKvx7UbsXm Oq5gRifF1QBVKaNwctLrXRkHf27Q2BPAu0WPeq9w= From: "joseph at codesourcery dot com" 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 16:55:45 +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: joseph at codesourcery dot com 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: 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 #12 from joseph at codesourcery dot com --- I agree that the side effects of an argument to __builtin_constant_p must=20 be discarded, for the original macro use case to work properly. There are various constructs with __builtin_* names that, although they=20 look like function calls, in fact have syntactic or semantic differences=20 from what can be done with a normal function call. In the cases of=20 syntactic differences, they are actually keywords and handled specially in= =20 the parsers. That's probably not relevant here, because the issue is=20 semantics of the call (argument not evaluated) rather than the syntax, but= =20 it does illustrate how it's reasonable to have special handling for some=20 __builtin_* construct when needed for its semantics.=