From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4FE0D385DC00; Sat, 4 Apr 2020 16:18:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FE0D385DC00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586017083; bh=QZUiC6ojif/Hb5MoXfOa1rMJGOGN9BveKAX4fOxCyO0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=U//AVS7/smwHUZgfdKMvOk2t9yrB4mtv8AX3XTI4oIh2BGSX4Skmcc5l1oQdN5YJu hNlW4mitYhVrkSMXB+92he5twRj+olZi5sQZQHsQZCuMISwV9BkkqcrkmUbtNnGmRt uaqUU6e1GlDic11ubu5+IXC4qQKGa8mVAyu4OsTY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94219] ICE in cxx_eval_bare_aggregate, at cp/constexpr.c:3790 Date: Sat, 04 Apr 2020 16:18:02 +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: 10.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2020 16:18:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94219 --- Comment #2 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:37244b217a7329792f4ec48027f63cf5010b0ea8 commit r10-7556-g37244b217a7329792f4ec48027f63cf5010b0ea8 Author: Patrick Palka Date: Thu Apr 2 12:59:34 2020 -0400 c++: Fix constexpr evaluation of self-modifying CONSTRUCTORs [PR94219] This PR reveals that cxx_eval_bare_aggregate and cxx_eval_store_express= ion do not anticipate that a constructor element's initializer could mutate the underlying CONSTRUCTOR. Evaluation of the initializer could add new elements to the underlying CONSTRUCTOR, thereby potentially invalidating any pointe= rs to or assumptions about the CONSTRUCTOR's elements, and so these routines should be prepared for that. To fix this problem, this patch makes cxx_eval_bare_aggregate and cxx_eval_store_expression recompute the constructor_elt pointers through which we're assigning, after it evaluates the initializer. Care is taken to = to not slow down the common case where the initializer does not modify the underlying CONSTRUCTOR. gcc/cp/ChangeLog: PR c++/94219 PR c++/94205 * constexpr.c (get_or_insert_ctor_field): Split out (while addi= ng support for VECTOR_TYPEs, and optimizations for the common case) from ... (cxx_eval_store_expression): ... here. Rename local variable 'changed_active_union_member_p' to 'activated_union_member_p'.= =20 Record the sequence of indexes into 'indexes' that yields the subobject we're assigning to. Record the integer offsets of the constructor indexes we're assigning through into 'index_pos_hints'. After evaluati= ng the initializer of the store expression, recompute 'valp' using 'indexes' and using 'index_pos_hints' as hints. (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field to recompute the constructor_elt pointer we're assigning through after evaluating each initializer. gcc/testsuite/ChangeLog: PR c++/94219 PR c++/94205 * g++.dg/cpp1y/constexpr-nsdmi3.C: New test. * g++.dg/cpp1y/constexpr-nsdmi4.C: New test. * g++.dg/cpp1y/constexpr-nsdmi5.C: New test. * g++.dg/cpp1z/lambda-this5.C: New test.=