[Bug target/72103] ICE with gcc 7 for povray benchmark
amodra at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Jul 26 02:42:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72103
Alan Modra <amodra at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-07-26
CC| |amodra at gmail dot com
Ever confirmed|0 |1
--- Comment #2 from Alan Modra <amodra at gmail dot com> ---
So, we are dealing with reloads for this insn:
(insn 488 206 406 31 (set (reg:DI 317)
(unspec:DI [
(fix:SI (reg:DF 105 28 [orig:173 _34 ] [173]))
] UNSPEC_FCTIWZ)) /home/alan/src/tmp/pr72103.ii:47 373 {fctiwz_df}
(nil))
First call to push_secondary_reload results in a call to our target
function:
rs6000_secondary_reload (in_p=false, x=0x7ffff6710c30, rclass_i=5, mode=DImode,
sri=0x7fffffffc900) at
/home/alan/src/gcc-virgin/gcc/config/rs6000/rs6000.c:19408
x is
(mem/c:DI (plus:DI (reg/f:DI 1 1)
(const_int 80 [0x50])) [6 %sfp+80 S8 A64])
rclass is VSX_REGS
returns FLOAT_REGS and
sri = {icode = 0, extra_cost = 0, prev_sri = 0x0, t_icode = 1}
Note the uninitialised t_icode field
Because we return something other than NO_REGS, we recurse into
push_secondaray_reload with the second call to our target function:
rs6000_secondary_reload (in_p=false, x=0x7ffff6710c30, rclass_i=3, mode=DImode,
sri=0x7fffffffc820) at
/home/alan/src/gcc-virgin/gcc/config/rs6000/rs6000.c:19408
x as before and rclass of course is FLOAT_REGS
This time we fall into default_secondary_reload where we hit this code
if (sri->prev_sri && sri->prev_sri->t_icode != CODE_FOR_nothing)
{
sri->icode = sri->prev_sri->t_icode;
return NO_REGS;
}
which copies the uninitialized t_icode field.
It seems that only default_secondary_reload sets sri->t_icode, in
other words we are only good to call default_secondary_reload on the
recursive call if default_secondary_reload was called on the first
call.
"Obvious" fix then is to add this to rs6000_secondary_reload
sri->t_icode = CODE_FOR_nothing;
and indeed this cures the ICE. We probably should do this just to harden
rs6000_secondary_reload.
More information about the Gcc-bugs
mailing list