https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91554
--- Comment #2 from Zack Weinberg <zackw at panix dot com> --- Additional fun detail: ``` static inline int thefun (void *a, void *b) { if (!__builtin_constant_p((__UINTPTR_TYPE__)b) || b != 0) thefun_called_with_nonnull_arg(); return real_thefun(a, b); } ``` still warns for any use of `thefun`, but ``` static inline int thefun (void *a, void *b) { if (!__builtin_constant_p((short)(__UINTPTR_TYPE__)b) || b != 0) thefun_called_with_nonnull_arg(); return real_thefun(a, b); } ``` works as intended! `(int)(__UINTPTR_TYPE__)` also works as intended on targets where __UINTPTR_TYPE__ is bigger than int. https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/builtins.c;h=f902e246f1f347be4d4dc04e339fa865393039fe#l8462 looks suspicious to me. Note also the STRIP_NOPS shortly above, which might explain why it matters whether the pointer is cast to a different-sized integer type.