[Bug c++/90383] [9/10 Regression] GCC generates invalid constexpr copy/move assignment operators for types with trailing padding. (Again)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90383 --- Comment #5 from Jakub Jelinek --- Author: jakub Date: Fri May 10 08:19:44 2019 New Revision: 271058 URL: https://gcc.gnu.org/viewcvs?rev=271058=gcc=rev Log: PR c++/90383 * tree-inline.h (struct copy_body_data): Add do_not_fold member. * tree-inline.c (remap_gimple_op_r): Avoid folding expressions if id->do_not_fold. (copy_tree_body_r): Likewise. (copy_fn): Set id.do_not_fold to true. * g++.dg/cpp1y/constexpr-90383-1.C: New test. * g++.dg/cpp1y/constexpr-90383-2.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-90383-1.C trunk/gcc/testsuite/g++.dg/cpp1y/constexpr-90383-2.C Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-inline.c trunk/gcc/tree-inline.h
[Bug c++/90383] [9/10 Regression] GCC generates invalid constexpr copy/move assignment operators for types with trailing padding. (Again)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90383 Jakub Jelinek changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek --- Created attachment 46321 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46321=edit gcc10-pr90383.patch And the bug is that when copy_fn makes a copy of the function for constexpr evaluation purposes, the inliner helper functions actually fold some expressions in it, which confuses the constexpr inline evaluation. This untested patch prevents that folding, which we really need just when actually inlining or performing other middle-end optimizations.
[Bug c++/90383] [9/10 Regression] GCC generates invalid constexpr copy/move assignment operators for types with trailing padding. (Again)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90383 --- Comment #3 from Jakub Jelinek --- struct alignas(8) A { constexpr A (bool x) : a(x) {} A () = delete; bool a; }; struct B { A b; }; constexpr bool foo () { B w{A (true)}; w.b = A (true); return w.b.a; } static_assert (foo (), ""); The problem is in that w.b = A (true); store, somehow we end up with w being a CONSTRUCTOR with type B, containing just FIELD_DECL a rather than FIELD_DECL b with another CONSTRUCTOR with type A, containing just FIELD_DECL a.
[Bug c++/90383] [9/10 Regression] GCC generates invalid constexpr copy/move assignment operators for types with trailing padding. (Again)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90383 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2019-05-08 CC||jakub at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Jakub Jelinek --- Started with my r269078 change (but it is only rejected with -O1 and higher, at -O0 it is accepted). Guess because always_true isn't evaluated in constexpr context.
[Bug c++/90383] [9/10 Regression] GCC generates invalid constexpr copy/move assignment operators for types with trailing padding. (Again)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90383 Richard Biener changed: What|Removed |Added Target Milestone|--- |9.2 Summary|[9 Regression] GCC |[9/10 Regression] GCC |generates invalid constexpr |generates invalid constexpr |copy/move assignment|copy/move assignment |operators for types with|operators for types with |trailing padding. (Again) |trailing padding. (Again)