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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |6.4.0
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2017-08-17
          Component|c                           |middle-end
                 CC|                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
            Summary|[7 Regression] bogus        |[7/8 Regression] bogus
                   |-Wstrict-overflow warning   |-Wstrict-overflow warning
                   |with -O3                    |with -O3
   Target Milestone|---                         |7.3

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is the loop distribution generated size argument to memcpy:

  <bb 2> [15.00%]:
  _1 = ca_7(D)->first_row;
  i_8 = _1 * 8;
  _13 = _1 + 1;
  _14 = _13 * 8;
  _17 = (unsigned int) _14;
  _2 = (unsigned int) i_8;
  _3 = _17 - _2;
  _5 = _3 + 4294967295;
  _4 = (sizetype) _5;
  _12 = _4 + 1;
  _11 = _12 * 8;
  _18 = i_8 < _14 ? _11 : 8;
  _19 = _1 * 8;
  _20 = (sizetype) _19;
  _21 = _20 * 8;
  _22 = ca_7(D) + _21;
  __builtin_memset (_22, 0, _18);

which later during forwprop which sees

  <bb 2> [15.00%]:
  _1 = ca_7(D)->first_row;
  i_8 = _1 * 8;
  _14 = i_8 + 8;
  _18 = i_8 < _14 ? 64 : 8;
  _19 = _14 - 8;
  _20 = (sizetype) _19;
  _21 = _20 * 8;
  _22 = ca_7(D) + _21;
  __builtin_memset (_22, 0, _18);

is optimized i_8 < i_8 + 8 -> 1 to

  <bb 2> [15.00%]:
  _1 = ca_7(D)->first_row;
  i_8 = _1 * 8;
  _14 = i_8 + 8;
  _18 = 64;
  _19 = i_8;
  _20 = (sizetype) i_8;
  _21 = _20 * 8;
  _22 = ca_7(D) + _21;
  __builtin_memset (_22, 0, _18);

this warning is somewhat fragile in that it triggers quite randomly and also
on compiler-generated intermediate code in case it gets a location.

Also warns on trunk.

I suppose we should look into niter analysis why it generates that conditional
and/or make sure niter generated GENERIC ends up with TREE_NO_WARNING set
and/or no location.

Reply via email to