https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101443
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 51148 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51148&action=edit gcc12-pr101443.patch Untested fix. I think it is best to optimize away these comparisons, as NULLPTR_TYPE has only one possible value, we can always determine the result, ==, <= and >= will be always true and !=, < and > will be always false. And keeping it around in the IL can break various optimizations, e.g. the range stuff (in fold-const and reassoc), or dom, anything that will try to build_int_cst 1 or -1 or something similar when it sees a comparison of something with INTEGER_CST.