[Bug tree-optimization/106093] [12/13 Regression] False positive -Wstringop-overflow with -O3 when resizing std::vector
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jan 16 10:53:26 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106093
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[Regression] False positive |[12/13 Regression] False
|-Wstringop-overflow with |positive
|-O3 when resizing |-Wstringop-overflow with
|std::vector |-O3 when resizing
| |std::vector
Ever confirmed|0 |1
Last reconfirmed| |2023-01-16
Status|UNCONFIRMED |NEW
CC| |jwakely.gcc at gmail dot com
Known to work| |11.3.0
Priority|P3 |P2
Target Milestone|--- |12.3
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.
(gdb) p debug_gimple_stmt (stmt)
# .MEM_120 = VDEF <.MEM_81>
MEM <vector(8) char> [(char *)vectp.79_117] = vect__18.77_116;
it's possibly a missed optimization for the vectorizer introduced compute
of the number of iterations. We have
<bb 7> [local count: 58465242]:
_23 = operator new (1);
*_23 = 0;
__cur_29 = _23 + 1;
if (_3 != _4)
goto <bb 8>; [89.00%]
<bb 8> [local count: 52034065]:
_15 = (unsigned long) _3;
_38 = (unsigned long) _4;
_36 = _15 - _38;
_54 = _36 + 18446744073709551615;
_10 = _54 > 6;
if (_10 != 0)
goto <bb 9>; [64.00%]
so we allocate 1 byte but then compute the iteration as difference from _4 and
_3 which are computed from
_3 = m_stream.D.31893._M_impl.D.31166._M_finish;
_4 = m_stream.D.31893._M_impl.D.31166._M_start;
in particular the new allocated storage is processed but the old size is used?!
More information about the Gcc-bugs
mailing list