[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Jason Merrill --- Fixed.
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 --- Comment #8 from Jason Merrill --- Author: jason Date: Fri Jan 10 18:47:02 2020 New Revision: 280127 URL: https://gcc.gnu.org/viewcvs?rev=280127=gcc=rev Log: PR c++/93143 - incorrect tree sharing with constexpr. We don't unshare CONSTRUCTORs as often during constexpr evaluation, so we need to unshare them here. * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume CONSTRUCTORs are already unshared. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array22.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org Target Milestone|--- |10.0
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 --- Comment #7 from bin cheng --- (In reply to bin cheng from comment #6) > (In reply to bin cheng from comment #5) > > (In reply to Martin Sebor from comment #4) > > > *** Bug 92926 has been marked as a duplicate of this bug. *** > > > > I sent a patch fixing this a > > https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00920.html > > The only question is if this one has already fixed by PR93033. > > Sorry, wrong comment. Hmm, seems my original comment is not wrong, and this issue still exists. I will update the patch.
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 --- Comment #6 from bin cheng --- (In reply to bin cheng from comment #5) > (In reply to Martin Sebor from comment #4) > > *** Bug 92926 has been marked as a duplicate of this bug. *** > > I sent a patch fixing this a > https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00920.html > The only question is if this one has already fixed by PR93033. Sorry, wrong comment.
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 --- Comment #5 from bin cheng --- (In reply to Martin Sebor from comment #4) > *** Bug 92926 has been marked as a duplicate of this bug. *** I sent a patch fixing this a https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00920.html The only question is if this one has already fixed by PR93033.
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Martin Sebor changed: What|Removed |Added CC||amker at gcc dot gnu.org --- Comment #4 from Martin Sebor --- *** Bug 92926 has been marked as a duplicate of this bug. ***
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Martin Sebor changed: What|Removed |Added CC||jason at gcc dot gnu.org Blocks||55004 --- Comment #3 from Martin Sebor --- Bisection points to r272126: Reduce unsharing in constexpr call evaluation. * constexpr.c (unshare_constructor): Only unshare if T is itself a CONSTRUCTOR. (cxx_eval_call_expression): Don't call it on the result here. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004 [Bug 55004] [meta-bug] constexpr issues
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 Martin Sebor changed: What|Removed |Added Keywords||wrong-code Status|UNCONFIRMED |NEW Last reconfirmed||2020-01-07 CC||msebor at gcc dot gnu.org Known to work||9.2.0 Ever confirmed|0 |1 Known to fail||10.0 --- Comment #2 from Martin Sebor --- Confirmed with today's top of trunk. A smaller test case is below. The original dump looks correct but the Gimple dump is not. The store to a.a[0] is missing from foobar(). $ cat pr93143.C && gcc -O2 -S -Wall -fdump-tree-gimple=/dev/stdout pr93143.C struct A { char a[2]; }; static constexpr A foo () { return A{1}; } void bar () { A a = foo (); if (a.a[0] != 1) __builtin_abort(); } void foobar () { A a = foo (); if (a.a[0] != 1) __builtin_abort(); } bar () { struct A a; try { a = {}; a.a[0] = 1; _1 = a.a[0]; if (_1 != 1) goto ; else goto ; : __builtin_abort (); : } finally { a = {CLOBBER}; } } foobar () { struct A a; try { a = {}; _1 = a.a[0]; if (_1 != 1) goto ; else goto ; : __builtin_abort (); : } finally { a = {CLOBBER}; } }
[Bug c++/93143] [10 Regression] Multiple calls to static constexpr member function gives wrong code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93143 --- Comment #1 from Lars Gullik Bjønnes --- Forgot to mention that it works nicely with GCC 9.