https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122083
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- The reduced testcase only gives one warning, but running the version in the testsuite with -Wnonnull gives two warnings: FAIL: 25_algorithms/lexicographical_compare_three_way/1.cc -std=gnu++20 (test for excess errors) Excess errors: /home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:1897: warning: argument 1 null where non-null expected because argument 3 is nonzero [-Wnonnull] /home/jwakely/src/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/stl_algobase.h:1897: warning: argument 2 null where non-null expected because argument 3 is nonzero [-Wnonnull] It's true that both arguments can be null, but the memcmp call is never reachable in that case.
