https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95673
--- Comment #3 from dn2sp-dev at yahoo dot fr --- (In reply to Martin Sebor from comment #2) > When the result of strncmp is only used to test for equality to zero that it > determines must evaluate to either true or false GCC 10 issues the > -Wstring-compare warning and folds those comparisons to the respective > constants (see the adjusted test case below). > > But GCC doesn't issue the warning when the result is also used for other > things like in the test case. I'm thinking it probably should warn > regardless. Thank you a lot for this clear explanation. Issuing -Wstring-compare even when the result is used could help because a useless (always false) string comparison is most likely the result of faulty code.