https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78501
--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Or perhaps check ptrdiff_type_node != NULL && TYPE_PRECISION (ptrdiff_type_node) == TYPE_PRECISION (size_type_node) before trying to optimize this? I mean, on VMS it might be fine if strlen returns 0xfffffffe (maximum size_t minus 1), if the address space is 64-bit and so is ptrdiff_t. So the above would only optimize on sane targets. The other uses of ptrdiff_type_node in the middle-end, which need fixing anyway, would need something like your patch, but not sure if it is not a waste of time to compute it if the C/C++ FE will immediately override it anyway. So perhaps just compute it that way in the LTO FE? I mean, for the *printf warning/length stuff, those calls shouldn't appear in Ada/Go/Fortran code, they can in LTO or C-family. The gimple-ssa-sprintf.c code could just check if ptrdiff_type_node is non-NULL and if it is NULL, punt.