https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114779
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- It isn't about side-effects. It is about it having pointer type. If you change your testcase to uintptr_t psfr_int = (uintptr_t) psfr; if (! __builtin_constant_p (psfr_int)) .... then it will work. __builtin_constant_p ((uintptr_t) psfr) will not work though, because the folding strips casts and the POINTER_TYPE_P case triggers in that case as well. I am not sure it would be a good idea to change the __builtin_constant_p behavior at this point, a lot of code in the wild might depend on its current behavior.