[Bug c++/79937] [5/6/7 Regression] ICE in replace_placeholders_r
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 7 15:10:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79937
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem here is that we're messing with placeholders in an unrelated
object:
For
C c = bar(X{1});
store_init_value sees:
c = TARGET_EXPR <D.2332, bar (TARGET_EXPR <D.2298, {.i=1,
.n=(&<PLACEHOLDER_EXPR struct X>)->i}>)>
We call replace_placeholders for the RHS. It's a TARGET_EXPR so we look at its
TARGET_EXPR_INITIAL, which is
bar (TARGET_EXPR <D.2298, {.i=1, .n=(&<PLACEHOLDER_EXPR struct X>)->i}>)
Then we walk this tree, find the
{.i=1, .n=(&<PLACEHOLDER_EXPR struct X>)->i}
CONSTRUCTOR, and recursively replace_placeholders_r for each value. Eventually
we find the <PLACEHOLDER_EXPR struct X> but that's for another object, so we
crash.
I.e., we shouldn't look into the second TARGET_EXPR, it has nothing to do with
"C c".
More information about the Gcc-bugs
mailing list