I can't produce a small test case for this because it involves copied
variables vanishing, but...
in expand_debug_locations() we have an assert thusly:
gcc_assert (mode == GET_MODE (val)
In the failing case I'm seeing (s390) I've got a pointer variable
that's SImode, being set from the address of another variable
(simplified example):
t = &s;
The vartrack stuff sees that t's own storage goes away, and sets its
var_location to an expression involving s. However, the expression is
DImode (the default pointer mode) where T is SImode, and the assert
fails. I.e. there's a lost cast somewhere.
I can work around this by testing for this specific case and just tossing
the debug info:
if (targetm.valid_pointer_mode (mode)
&& targetm.valid_pointer_mode (GET_MODE (val))
&& mode != GET_MODE (val))
{
val = gen_rtx_UNKNOWN_VAR_LOC ();
}
else
... the assert ...
but this smells like a hack. However, i'm having a hard time finding
out where this stuff is being set up.
Suggestions?