[Bug tree-optimization/118557] -Wstringop-overflow false positive for span on array/string_view due to the vectorizer

2025-01-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118557

--- Comment #5 from Andrew Pinski  ---
```
  if (SR.27_27 == 0)
goto ; [50.00%]
  else
goto ; [50.00%]

   [local count: 59055800]:
  _23 = MIN_EXPR ;
  _16 = SR.28_25 + _23;
  if (SR.27_27 != 0)
goto ; [89.00%]
  else
goto ; [11.00%]
```

That is also missed.

[Bug tree-optimization/118557] -Wstringop-overflow false positive for span on array/string_view due to the vectorizer

2025-01-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118557

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||missed-optimization
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
   Last reconfirmed||2025-01-19

--- Comment #4 from Andrew Pinski  ---
Couple of missed optimizations which is causing the vectorizer to decide to
over vectorize:
```
  _15 = SR.26_4 + _21;
  if (SR.26_4 != _15)
goto ; [89.00%]
  else
goto ; [11.00%]
;;succ:   10 [89.0% ...
```
Should just be if (_21 != 0)



Note I change copy to be:
```static inline
void copy(span in, span out) {
auto f = in.begin();
auto o = out.begin();
auto s = in.size();
for(size_t t = 0; t < s; t++)
{
  *o++ = *f++;
}
}
```

It works.

[Bug tree-optimization/118557] -Wstringop-overflow false positive for span on array/string_view due to the vectorizer

2025-01-19 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118557

Andrew Pinski  changed:

   What|Removed |Added

Summary|-Wstringop-overflow false   |-Wstringop-overflow false
   |positive for span on|positive for span on
   |array/string_view   |array/string_view due to
   ||the vectorizer

--- Comment #3 from Andrew Pinski  ---
-fno-tree-vectorize hides the warning.

The size of 8 gave me the hint that this was most likely the vectorizer.