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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On this particular testcase, we have before esra:
  _3 = (unsigned _BitInt(3)) v0_8;
  _4 = _3 + 7;
  _5 = (_BitInt(3)) _4;
  s0.f1 = _5;

  <bb 5> :
  _6 = s0.f1;
  _7 = (long long unsigned int) _6;
wgere v0_8 range is [0,1].
Naturally, _4 range is [0,0][7,7] and that converted to _BitInt(3) is
[-1,0],
esra changes that to
   _3 = (unsigned _BitInt(3)) v0_8;
   _4 = _3 + 7;
   _5 = (_BitInt(3)) _4;
-  s0.f1 = _5;
+  _16 = VIEW_CONVERT_EXPR<_BitInt(8)>(_5);
+  s0_17 = _16;

   <bb 5> :
-  _6 = s0.f1;
+  # s0_13 = PHI <s0_10(D)(2), s0_17(4)>
+  _6 = VIEW_CONVERT_EXPR<_BitInt(3)>(s0_13);
   _7 = (long long unsigned int) _6;
Before vrp1 we still have
  _3 = (unsigned _BitInt(3)) v0_7;
  _4 = _3 + 7;
  _12 = VIEW_CONVERT_EXPR<_BitInt(8)>(_4);

  <bb 5> [local count: 236223200]:
  # s0_10 = PHI <s0_8(D)(2), _12(4)>
  _5 = VIEW_CONVERT_EXPR<_BitInt(3)>(s0_10);
Range of _3 and _4 are computed correctly:
_3  : [irange] unsigned _BitInt(3) [0, 1] MASK 0x1 VALUE 0x0
_4  : [irange] unsigned _BitInt(3) [0, 0][+INF, +INF]
Before the change, _12 wasn't mentioned (so VARYING?), now is incorrectly
[0,0]:
Folding statement: _12 = VIEW_CONVERT_EXPR<_BitInt(8)>(_4);
Queued stmt for removal.  Folds to: 0

Reply via email to