https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122625
--- Comment #11 from Nathaniel Shead <nshead at gcc dot gnu.org> --- (In reply to d7d1cd from comment #10) > Thanks for the correction, but there's a caveat... > > If you add the -Wall -Werror -O0 compilation options to the original > example, it links successfully (https://godbolt.org/z/4r59razqc). However, > if you specify -O2 or -O3 optimization (https://godbolt.org/z/3fsxc1Tx1), > you'll get a warning: > > include/c++/16.0.0/bits/stl_iterator.h:1111:16: error: array subscript 2 > is outside array bounds of 'const char32_t [1]' [-Werror=array-bounds=] > 1111 | { return __normal_iterator(_M_current++); } > > include/c++/16.0.0/format:847:28: note: at offset 8 into object '__arr' > of size 4 > 847 | const char32_t __arr[1]{ __fill_char }; > > > Compiler 15.2 doesn't have this problem. Thanks. This looks unrelated I think, would you mind opening a new bug report for this? I'll try and reduce it sometime next week.
