This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 5 Aug 2005 09:59:53 -0400
- Subject: PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE
In PR 23046 we ICE inside tree-vrp.c because fold() does not
realize that for
enum enumtype { ENUM1, ENUM2 } x;
the predicate 'if (x > 1)' is always false. This causes VRP to
create the impossible range [2, 1] for that predicate.
While it would be trivial for VRP to paper over this problem, the
real fix should be in fold(). I looked at the logic that detects
these cases and it is fairly convoluted (fold-const.c:9174).
I'm wondering why doesn't fold() just use TYPE_MAX_VALUE/TYPE_MIN_VALUE
if they're available?
Thanks.