[Bug tree-optimization/85788] False positive of -Wstringop-overflow= warning

2018-05-16 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85788

--- Comment #2 from Martin Liška  ---
Created attachment 44137
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44137=edit
original test-case

On trunk disappeared in r259672. I'm attaching original test-case which
reproduces on trunk as well.

[Bug tree-optimization/85788] False positive of -Wstringop-overflow= warning

2018-05-15 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85788

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-05-15
 Ever confirmed|0   |1
  Known to fail||7.3.0, 8.1.0

--- Comment #1 from Martin Sebor  ---
Confirmed at -O2 with GCC 8.1 but only at -O3 on trunk where the warning sees:

n ()
{
  int * c;
  int b.2_13;
  int b.2_16;
  int pretmp_25;
  int pretmp_26;
  int _28;
  int _31;
  long unsigned int _33;

   [local count: 1073741826]:
  c_3 = d;
  if (c_3 != 0B)
goto ; [89.00%]
  else
goto ; [11.00%]

   [local count: 1073741817]:
  pretmp_25 = m.g;
  pretmp_26 = m.h;
  _28 = pretmp_25 / 8;
  _31 = pretmp_26 * _28;
  _33 = (long unsigned int) _31;
  b.2_16 = b;
  __builtin___memset_chk (, b.2_16, _33, 64000); [tail call]
  return;

   [local count: 955630226]:
  c_4 = e;
  if (c_4 != 0B)
goto ; [89.00%]
  else
goto ; [11.00%]

   [local count: 955630226]:
  MEM[(int *)] = 140733193420799;
  b.2_13 = b;
  __builtin___memset_chk (, b.2_13, 134180865, 64000);
  goto ; [100.00%]

   [local count: 7731917263]:
  goto ; [100.00%]

   [local count: 8687547448]:
  goto ; [100.00%]

}


In function ‘a’,
inlined from ‘make_str_raster.constprop’ at t.c:17:3,
inlined from ‘n’ at t.c:22:12:
t.c:5:3: warning: ‘__builtin___memset_chk’ writing 134180865 bytes into a
region of size 64000 overflows the destination [-Wstringop-overflow=]
   __builtin___memset_chk(k, b, l, f);
   ^~