From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C2E023858C74; Tue, 31 Oct 2023 14:05:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2E023858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698761101; bh=kAFE+ucbrr7X7UtNdQBKXAkmnkZvqZuv7bxUbKbPcxQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YNTemE0fWX1PT8MIFOZ649xkHaE4Uj2jCBQc/7J5sd3WMrR8NspO/Mkf/S6QwlI9F 3fRNLYkNJincNXjrVj2ZIUmkY9JAG1OkB62G4bdZRu9bz78sofVu3hXQyuN+Ld43iX 0xwFZei9rzwYWgu22KVjkitQSUZF1z3N1O3sXokI= 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 14:05:01 +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 #9 from Richard Henderson --- > Thanks. So yes, >=20 > macro(x++); >=20 > incrementing x twice would have been odd - but that's the usual bug > in this kind of macro definition. Fixing it by throwing away > side-effects (and always going the out_of_line_function (x) path!) > for the __builtin_constant_p argument is an odd choice. In the beginning __builtin_constant_p was resolved immediately, so formulating this as #define macro(x) \ ({ __typeof(x) _x =3D (x); \ __builtin_constant_p(_x) }) would always return false, defeating the purpose. > The execute.exp testcase suggests the intention but the testcases > verification is somewhat incomplete (it lacks verifying the side-effects > are gone). That's probably my omission. ;-)=