[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 --- Comment #10 from Jason Merrill --- Author: jason Date: Thu Dec 19 00:10:47 2019 New Revision: 279557 URL: https://gcc.gnu.org/viewcvs?rev=279557=gcc=rev Log: PR c++/91165 follow-on tweak I talked in the PR about possibly stripping the location from the args in the hash table, since if we use the cache the locations would be wrong, but didn't actually do anything about that. Then I noticed that there's already unshare_expr_without_location... * constexpr.c (cxx_eval_call_expression): Use unshare_expr_without_location. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Jason Merrill --- Fixed.
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 --- Comment #8 from Jason Merrill --- Author: jason Date: Mon Dec 16 23:25:08 2019 New Revision: 279447 URL: https://gcc.gnu.org/viewcvs?rev=279447=gcc=rev Log: PR c++/91165 - verify_gimple ICE with cached constexpr. It seems we need to unshare even non-CONSTRUCTOR expressions that we are going to stick in the constexpr_call_table, so we don't end up sharing the same e.g. ADDR_EXPR between two different functions. I now think I understand why unsharing CONSTRUCTOR arguments was improving memory performance: separating the arguments from the caller function allows the caller function to be GC'd better. But it occurs to me that we don't need to unshare until we decide that we're evaluating and caching this call, so we can avoid the CONSTRUCTOR unshare/free pair for tentative arguments. Freeing the tentative TREE_VEC still seems worth doing, so free_bindings isn't going away entirely. * constexpr.c (cxx_bind_parameters_in_call): Don't unshare. (cxx_eval_call_expression): Unshare all args if we're caching. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-string2.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 --- Comment #7 from Jason Merrill --- (In reply to Jakub Jelinek from comment #6) > Slightly further reduced #c3: > template constexpr T bar (T c) { return c; } > template struct S { > T f; > U g; > constexpr S (T c, U h) : f(c), g(h) {} > }; > template > constexpr S foo (T &, U h) { return S (c, bar (h)); } > struct C { void baz (int); void qux (); }; > void C::baz (int a) { foo (a, ""); } > void C::qux () { foo (0, ""); } > > Seems some TARGET_EXPR is not unshared during the constexpr evaluation. The expression that isn't being unshared here is &"", which is built in baz, cached as the result of bar(&""), and reused when we again see bar(&"") while evaluating the call to foo in qux. This seems like reasonable sharing to me, but perhaps we should strip locations from cached results.
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #6 from Jakub Jelinek --- Slightly further reduced #c3: template constexpr T bar (T c) { return c; } template struct S { T f; U g; constexpr S (T c, U h) : f(c), g(h) {} }; template constexpr S foo (T &, U h) { return S (c, bar (h)); } struct C { void baz (int); void qux (); }; void C::baz (int a) { foo (a, ""); } void C::qux () { foo (0, ""); } Seems some TARGET_EXPR is not unshared during the constexpr evaluation.
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 --- Comment #5 from Martin Liška --- My reduced test-case is probably very similar: template constexpr _Tp forward(_Tp p1) { return p1; } template struct A { _T1 first; _T2 second; constexpr A(_T1 p1, _T2 p2) : first(p1), second(p2) {} }; template constexpr A<_T1, _T2> make_pair(_T1 &, _T2 p2) { return A<_T1, _T2>(forward(p1), forward(p2)); } typedef enum { EShLangCount } EShLanguage; class B { A m_fn1() const; }; const int a = 0; void DecodeLineDirective() { make_pair(a, ""); } A B::m_fn1() const { make_pair(EShLangCount, ""); }
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 Martin Liška changed: What|Removed |Added Priority|P3 |P1 --- Comment #4 from Martin Liška --- I can confirm that it breaks shaderc package. @Jason: Can you please take a look?
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 Marek Polacek changed: What|Removed |Added CC||mpolacek at gcc dot gnu.org --- Comment #3 from Marek Polacek --- Cleaned up testcase: template constexpr T bar(T c) { return c; } template struct S { T f; U g; constexpr S(T c, U h) : f(c), g(h) {} }; template constexpr S foo(T &, U h) { return S(c, bar (h)); } enum { X }; class C { void m_fn1() const; }; void baz (int a) { foo(a, ""); } void C::m_fn1() const { foo(X, ""); }
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 --- Comment #2 from David Binderman --- Three months later, still broken.
[Bug c++/91165] [10 Regression] error: location references block not in block tree
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91165 Martin Liška changed: What|Removed |Added Status|UNCONFIRMED |NEW Known to work||9.1.0 Version|unknown |10.0 Keywords||ice-on-valid-code Last reconfirmed||2019-07-15 CC||jason at gcc dot gnu.org, ||marxin at gcc dot gnu.org Ever confirmed|0 |1 Summary|error: location references |[10 Regression] error: |block not in block tree |location references block ||not in block tree Target Milestone|--- |10.0 Known to fail||10.0 --- Comment #1 from Martin Liška --- Confirmed, started with r272126.