public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@codesourcery.com>
To: Dave Korn <dk@artimi.com>
Cc: gcc@gcc.gnu.org
Subject: Re: warning: right shift count >= width of type
Date: Mon, 29 Nov 2004 16:33:00 -0000	[thread overview]
Message-ID: <41AB4E8A.4020801@codesourcery.com> (raw)
In-Reply-To: <NUTMEG5kpCUsVt1IDz7000001b1@NUTMEG.CAM.ARTIMI.COM>

Dave Korn wrote:
> 
>   Afternoon all.  Here's something that's piqued my curiosity; it's probably
> owing to some language-lawyerly issue, but it isn't obvious to me.  This is
> on gcc-3.3.3, (cygwin variant, but that's probably not relevant):
> 
> -------------------------<snip!>-------------------------
> dk@mace /test/shift-test> cat foo.c
> 
> unsigned int bar (unsigned int baz)
> {
> unsigned int quux;
> 
>         quux = baz >> 32;
>         return quux;
> }
> 
> dk@mace /test/shift-test> gcc -S foo.c -O2 -o foo.s
> foo.c: In function `bar':
> foo.c:7: warning: right shift count >= width of type
> dk@mace /test/shift-test> cat foo.s

>   Why isn't the shift operation optimised away and replaced with const_int
> 0?

It's _undefined_.  Didn't you make some comment about what undefined
meant last week :)

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

  reply	other threads:[~2004-11-29 16:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-29 16:30 Dave Korn
2004-11-29 16:33 ` Nathan Sidwell [this message]
2004-11-29 17:01 ` Andrew Haley
2004-11-29 17:12 ` Dale Johannesen
2004-11-29 17:14   ` Dave Korn
2004-11-29 17:26     ` Andrew Haley
2004-11-29 18:29       ` Peter Barada
2004-11-29 18:53         ` Dave Korn
2004-11-29 18:52       ` Dave Korn
2004-11-29 19:09         ` Andrew Haley
2004-11-29 19:17           ` Dale Johannesen
2004-11-29 19:54             ` Dave Korn
2004-11-29 17:38     ` Chris Jefferson
2004-11-29 18:46       ` Dave Korn
2004-11-29 19:19         ` Chris Jefferson
2004-11-29 19:46           ` Dave Korn
2004-11-29 23:49 Paul Schlie
2004-11-30  1:50 ` Andreas Schwab
2004-11-30  4:23 Paul Schlie

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=41AB4E8A.4020801@codesourcery.com \
    --to=nathan@codesourcery.com \
    --cc=dk@artimi.com \
    --cc=gcc@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).