[Bug tree-optimization/123850] [15 Regresion] vector resize: bits/stl_construct.h:133:7: error: array subscript 5 is outside array bounds of ‘char [5]’ [-Werror=array-bounds=]

syq at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 28 03:09:57 GMT 2026


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

--- Comment #3 from YunQiang Su <syq at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> The bug is only inside main there are dups.

Yes, or not.

```
int f() {
   std::vector<char> v = {1, 2, 3, 4, 5};
   v.resize(49);
   // no return: this will emit another warning/error.
}
```

also emit this warning;


More information about the Gcc-bugs mailing list