[Bug c++/123423] New: Bad range end when using split_view twice in optimized mode
Sebastien.Ponce at cern dot ch
gcc-bugzilla@gcc.gnu.org
Tue Jan 6 17:47:10 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123423
Bug ID: 123423
Summary: Bad range end when using split_view twice in optimized
mode
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Sebastien.Ponce at cern dot ch
Target Milestone: ---
It looks like there is an issue with std::ranges::split_view, when it is
applied twice to split further the results of a first split, namely the end of
the last subrange of the first range is not correct.
this only happens in optimized mode (-O2, -O3) and runs fine in -O1 or -Og
mode.
I've built a reproducer on godbolt : https://godbolt.org/z/3MvYYGEb4
It parses the string "v1=v2,v3=v4" by spliting first on "," and then further
spliting on "=".
See how the -O1 version parses correctly the input, splitting first on ',' and
then on '=' while the -O2 version fails in having a proper end for the first
item.
More information about the Gcc-bugs
mailing list