[Bug tree-optimization/106131] [10/11/12/13 Regression] -fstrict-aliasing breaks normal program that does not use any pointer or reference

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 30 07:57:34 GMT 2022


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the issue seems to be that fre1 transforms

  <bb 3> :
  _1 = (long unsigned int) i_13;
  _2 = _1 * 8;
  _3 = _18 + _2;
  _40 = MEM[(const struct Pair &)_18].a;
  _3->a = _40;
  _44 = MEM[(const struct Pair &)_18].b;
  _3->b = _44;
  if (i_13 == 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  _5 = (long unsigned int) i_13;
  _6 = _5 * 8;
  _7 = _18 + _6;
  _45 = MEM[(const struct Pair &)_18 + 16].a;
  _7->a = _45;
  _46 = MEM[(const struct Pair &)_18 + 16].b;
  _7->b = _46;

  <bb 5> :
  _9 = (long unsigned int) i_13;
  _10 = _9 * 8;
  _11 = _18 + _10;
  x = MEM[(const struct Pair &)_11];
  y = MEM[(const struct Pair &)_18 + 8];
  _47 = MEM[(const int &)&x + 4];
  _48 = MEM[(const int &)&y + 4];
  if (_47 < _48)
    goto <bb 7>; [50.00%]
  else
    goto <bb 6>; [50.00%]

into

...
  <bb 5> :
  x = MEM[(const struct Pair &)_3];
  y = MEM[(const struct Pair &)_18 + 8];
  _48 = MEM[(const int &)&y + 4];
  if (_44 < _48)
    goto <bb 7>; [50.00%]
  else
    goto <bb 6>; [50.00%]

CSEing the load _47 = MEM[(const int &)&x + 4]; to _44 crossing the
conditional clobber in BB4.


More information about the Gcc-bugs mailing list