[Bug rtl-optimization/24899] [4.1/4.2 Regression] loop.c miscompiles libgnomecanvas

jakub at redhat dot com gcc-bugzilla@gcc.gnu.org
Thu Dec 15 10:48:00 GMT 2005



------- Comment #23 from jakub at redhat dot com  2005-12-15 10:48 -------
The problem seems to be that strength_reduce -> loop_givs_reduce reduces a giv
that is not always_computable (and as shown on the segfault, it really can't be
computed unconditionally).
p *bl->giv
$16 = {insn = 0x2aaaadc389b0, new_reg = 0x2aaaadc3d3e0, src_reg =
0x2aaaadc30d60, giv_type = DEST_REG,
  dest_reg = 0x2aaaadc30da0, location = 0x0, mode = SImode, mem = 0x0, mult_val
= 0x2aaaadc3b2c0, add_val = 0x2aaaada5a400,
  benefit = 16, final_value = 0x0, combined_with = 0, replaceable = 0,
not_replaceable = 0, ignore = 0, always_computable = 0,
  always_executed = 0, maybe_multiple = 0, cant_derive = 1, maybe_dead = 0,
auto_inc_opt = 0, shared = 0, no_const_addval = 1,
  lifetime = 18, derive_adjustment = 0x0, ext_dependent = 0x0, next_iv = 0x0,
same = 0x0, same_insn = 0x0, last_use = 0x0}

p debug_rtx (bl->giv->add_val)
(const_int 0 [0x0])
p debug_rtx (bl->giv->mult_val)
(mem:SI (reg/v/f:DI 67 [ z ]) [2 S4 A32])

I'm not sure though if just adding
if (!v->always_computable)
  {
    if (loop_dump_stream)
      fprintf (loop_dump_stream,
               "giv of insn %d: not always computable.\n",
               INSN_UID (v->insn));
    v->ignore = 1;
    bl->all_reduced = 0;
  }
to the loop in strength_reduce a few lines above loop_givs_reduce call
wouldn't be a too big hammer for this.
Alternatively check if (!v->always_computable && (may_trap_or_fault_p
(v->add_val) || (may_trap_or_fault_p (v->mult_val)).

BTW, I don't think P3 is the right priority here, IMHO P1 would be more
suitable.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24899



More information about the Gcc-bugs mailing list