https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105727
--- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> --- I don't know what clang does, but GCC keeps builtin_constant_p till late optimization and resolves it then. So here we cross module inline (or constant propagate) and then it becomes constant. Outcome of __builtin_constant_p should depend on optimization settings and LTO is one of them. So I would say that both clang and gcc are correct, just gcc has better QOI. Why this breaks kernel?