From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AA0443858C36; Thu, 7 Mar 2024 18:58:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA0443858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709837893; bh=DKrFG9+6Vs0JGB1z5hfsP4agAbiH3nWxJaMUoZQuLYk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iO16vAjxmoeXGX80DKZ6Kcwj72DUpyOgQ0hoDFBMjJ0HswejyVVukLHLRtiG8V3+z VKzKQ7x3Zc2oEobM1Hvt6lo1xvLyLHFIt0QeDray9JiUJAUrgMfXc7ggfLmVLcHpvE 8YlvgdB/f1tOggf/bY2wRR0mVbrODMu4FQ3D2FS4= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111284] [11/12/13/14 Regression] Some passing-by-value parameters are mishandled since GCC 9, affecting libstdc++'s constexpr std::string Date: Thu, 07 Mar 2024 18:58:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: accepts-invalid, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created 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=3D111284 --- Comment #8 from Jakub Jelinek --- Created attachment 57648 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57648&action=3Dedit gcc14-pr111284.patch So, I've tried to fix this by constexpr evaluating the arguments passed to PARM_DECLs with TREE_ADDRESSABLE types in the caller as lvalues rather than rvaluea and later, if we try to evaluate the PARM_DECL in the callee as lva= l, lookup the value and use that, if it is rval constexpr evaluate again as rvalue. There is a complication for qualified type, say if the argument is const in= the callee and caller is passing reference to non-const, adjust_temp_type can't handle that when it isn't a rvalue.=