https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106778
Bug ID: 106778 Summary: libcpp/makeuname2c.cc:454: sanity check in wrong place ? Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- Static analyser cppcheck can be made to say: libcpp/makeuname2c.cc:454:19: style: Array index 'off' is used before limits check. [arrayIndexThenCheck] Source code is assert (tree[off] == 0 && off < tree_size); Suggest sanity check array index before use, not after.