https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78312

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2016-11-11
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
   Target Milestone|---                         |7.0
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm.

So [0, 1] * ~[1, 65534] gets

MEET ([0, 1] * [0, 0] == [0, 0],
      [0, 1] * [65535, 65535] == ~[1, 65534]) == ~[1, 65534]

that looks ok to me.

And then ~[1, 65534] * ~[1, 65534] is [0, 1], also ok.

But then somewhen the IL changes to


  <bb 2>:
  # RANGE [0, 1]
  _1 = p1_8(D) > 0;
  # RANGE [0, 1] NONZERO 1
  _2 = (short unsigned int) _1;
  # RANGE ~[1, 65534]
  _3 = -_2;
  # RANGE [0, 1]
  _4 = _3 != 0;
  # RANGE [0, 1] NONZERO 1
  _5 = (short unsigned int) _4;
  # RANGE ~[1, 65534]
  _6 = _2 * _5;

and [0,1] * [0, 1] is not ~[1, 65534].

It is backprop messing up the IL, invalidating the range-info on SSA names.

Index: gcc/gimple-ssa-backprop.c
===================================================================
--- gcc/gimple-ssa-backprop.c   (revision 242066)
+++ gcc/gimple-ssa-backprop.c   (working copy)
@@ -728,6 +728,7 @@ backprop::prepare_change (tree var)
 {
   if (MAY_HAVE_DEBUG_STMTS)
     insert_debug_temp_for_var_def (NULL, var);
+  reset_flow_sensitive_info (var);
 }

 /* STMT has been changed.  Give the fold machinery a chance to simplify

Reply via email to