https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107465
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I have not tested this at all but I suspect this patch will fix the issue: apinski@xeond:~/src/upstream-gcc/gcc/gcc/c-family$ git diff c-warn.cc diff --git a/gcc/c-family/c-warn.cc b/gcc/c-family/c-warn.cc index 6742f447ff5..44d16111370 100644 --- a/gcc/c-family/c-warn.cc +++ b/gcc/c-family/c-warn.cc @@ -2302,8 +2302,8 @@ warn_for_sign_compare (location_t location, sop = fold_for_warn (sop); uop = fold_for_warn (uop); - STRIP_TYPE_NOPS (sop); - STRIP_TYPE_NOPS (uop); + STRIP_SIGN_NOPS (sop); + STRIP_SIGN_NOPS (uop); base_type = (TREE_CODE (result_type) == COMPLEX_TYPE ? TREE_TYPE (result_type) : result_type); ------ CUT ---- And if it does, then I was right on the reason why typedef vs using unsigned short directly too.