https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101466
Bug ID: 101466 Summary: Optimizers should fold bounds checking for -D_GLIBCXX_ASSERTIONS=1 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: unlvsur at live dot com Target Milestone: --- https://godbolt.org/z/fPdGeKMYM Should fold together and optimize to something like this https://godbolt.org/z/6cooP81xc