public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@redhat.com>
To: Diego Novillo <dnovillo@redhat.com>
Cc: Roger Sayle <roger@eyesopen.com>, gcc@gcc.gnu.org
Subject: Re: PR 23046.  Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE
Date: Fri, 05 Aug 2005 17:58:00 -0000	[thread overview]
Message-ID: <1123264666.8684.94.camel@localhost.localdomain> (raw)
In-Reply-To: <20050805135953.GA23609@topo.toronto.redhat.com>

On Fri, 2005-08-05 at 09:59 -0400, Diego Novillo wrote:
> 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?
IIRC the C standard does not guarantee that an object stay within
the bounds of its enumerated type.  You'll have to do some digging
in the relevant standards.

jeff


  parent reply	other threads:[~2005-08-05 17:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-05 14:00 Diego Novillo
2005-08-05 16:35 ` Roger Sayle
2005-08-05 17:58 ` Jeffrey A Law [this message]
2005-08-05 20:04   ` PR 23046. Folding predicates involving TYPE_MAX_VALUE/TYPE_MIN_VALUE (Ada RFC) Richard Henderson
2005-08-05 20:15     ` Florian Weimer
2005-08-05 20:56       ` Richard Henderson
2005-08-05 21:04         ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1123264666.8684.94.camel@localhost.localdomain \
    --to=law@redhat.com \
    --cc=dnovillo@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=roger@eyesopen.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).