public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: Graham Stott <graham.stott@btinternet.com>
To: gcc-bugzilla@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org
Subject: Re: [Bug middle-end/17036] [3.5 Regression] ICE: (A >> N) & 1 ? (1 << N) : 0 where A of type unsigned int
Date: Sun, 15 Aug 2004 18:05:00 -0000	[thread overview]
Message-ID: <411FA5D7.3030003@btinternet.com> (raw)
In-Reply-To: <20040815170538.25318.qmail@sourceware.org>

pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-15 17:05 -------
> Confirmed
> : Search converges between 2004-06-20-trunk (#469) and 2004-06-22-trunk (#470).
> Reduced to:
> int main( int argc, char **arg )
> {
>  int R , N = 4;
>  unsigned int A = 2;
>  signed int B = 2;
>  ((B >> N) & 1) ? 1 : 0;
>  ((A >> N) & 1) ? 1 : 0;
>  return 0;
> }
> 
> 
> Looks like someone forgets to check to make sure that the N is really a constant.
> 

This patch should fixit but I don't have time to do a full bootstrap and
regression test on the patch.

-------------------------------------------------------------------
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.435
diff -c -p -r1.435 fold-const.c
*** fold-const.c        12 Aug 2004 04:01:04 -0000      1.435
--- fold-const.c        15 Aug 2004 17:53:10 -0000
*************** fold (tree expr)
*** 8874,8879 ****
--- 8874,8880 ----
           tree tem = TREE_OPERAND (arg0, 0);
           STRIP_NOPS (tem);
           if (TREE_CODE (tem) == RSHIFT_EXPR
+             && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
                 && (unsigned HOST_WIDE_INT) tree_log2 (arg1) ==
                  TREE_INT_CST_LOW (TREE_OPERAND (tem, 1)))
             return fold (build2 (BIT_AND_EXPR, type,
-------------------------------------------------------------------


  reply	other threads:[~2004-08-15 18:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-15 16:55 [Bug c/17036] New: " bommar33 at msu dot edu
2004-08-15 16:57 ` [Bug c/17036] " bommar33 at msu dot edu
2004-08-15 17:05 ` [Bug middle-end/17036] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-08-15 18:05   ` Graham Stott [this message]
2004-08-15 18:05 ` graham dot stott at btinternet dot com
2004-08-15 18:57 ` bommar33 at msu dot edu
2004-08-16  7:19 ` paolo dot bonzini at polimi dot it
2004-08-17  7:40 ` cvs-commit at gcc dot gnu dot org
2004-08-17  8:19 ` pinskia at gcc dot gnu dot org

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=411FA5D7.3030003@btinternet.com \
    --to=graham.stott@btinternet.com \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-bugzilla@gcc.gnu.org \
    /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).