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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Compiler emits unexpected   |ldist might punt on too
                   |function call that may      |large expressions for
                   |cause security problems     |detected patterns with -Os
     Ever confirmed|0                           |1
                 CC|                            |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2020-12-21
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, for -Os I guess we should reopen this for the case where the expressions
needed for the detected patterns look too big.
ldist in this case turns the loop into:
  _34 = _3 + -1;
  _33 = (unsigned int) _34;
  _32 = (sizetype) _33;
  _35 = _32 * 8;
  _36 = _3 > 0 ? _35 : 0;
  _37 = (long unsigned int) nm_25;
  _38 = _37 * 8;
  _39 = (sizetype) _33;
  _40 = 1 - _39;
  _41 = _40 * 8;
  _42 = _3 > 0 ? _41 : 8;
  _43 = _38 + _42;
  _44 = p_20 + _43;
  _45 = (long unsigned int) nm_25;
  _46 = _45 * 8;
  _47 = (unsigned int) _34;
  _48 = (sizetype) _47;
  _49 = 1 - _48;
  _50 = _49 * 8;
  _51 = _3 > 0 ? _50 : 8;
  _52 = _46 + _51;
  _53 = _52 + 18446744073709551608;
  _54 = p_20 + _53;
  __builtin_memmove (_44, _54, _36);
and while some of it is optimized later, we still have:
  _4 = (long unsigned int) nm_25;
  _5 = _4 * 8;
  _6 = p_20 + _5;
  _33 = (unsigned int) nm_25;
  _32 = (sizetype) _33;
  _35 = _32 * 8;
  _36 = _3 > 0 ? _35 : 0;
  _40 = 1 - _32;
  _41 = _40 * 8;
  _42 = _3 > 0 ? _41 : 8;
  _43 = _5 + _42;
  _44 = p_20 + _43;
  _9 = _5 + 18446744073709551608;
  _53 = _9 + _42;
  _54 = p_20 + _53;
in *.optimized.

Reply via email to