http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58564
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 30933 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30933&action=edit gcc49-pr58564-nonnegative.patch Actually, teaching fold that it should fold that < 0 into 0 is easy, just needs making some checks less strict (they were considering only INTEGER_TYPE, forgetting about BOOLEAN_TYPE or ENUMERAL_TYPE which IMHO can be handled the same). This latter patch I'm obviously not going to propose for the older branches.