public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/16790] [3.3/3.4/3.5 regression] Integer down cast ignored in larger expression
Date: Tue, 27 Jul 2004 23:12:00 -0000	[thread overview]
Message-ID: <20040727231222.4150.qmail@sourceware.org> (raw)
In-Reply-To: <20040727223545.16790.andyb@mathworks.com>


------- Additional Comments From bangerth at dealii dot org  2004-07-27 23:12 -------
Confirmed. A regression in 3.3/3.4/mainline against 2.95. Here's  
a reduced testcase: 
---------------- 
void abort (); 
 
static void compute(unsigned int u1) 
{ 
  unsigned char same_result; 
 
  signed short y_final_1; 
  signed short y_middle; 
  signed short y_final_2; 
 
  y_final_1 = (signed short)( (signed short)(u1 << 1) * 3 >> 1); 
  y_middle  =                 (signed short)(u1 << 1); 
  y_final_2 = (signed short)( y_middle * 3 >> 1); 
 
  if (y_final_1 != y_final_2) 
    abort (); 
} 
 
main() 
{ 
  compute(0x4000U); 
} 
----------------------------- 
 
Note that (0x4000<<1) is just the corner case when casted to signed int, 
since it has only the sign bit set, none of the other bits are set. We 
seem to get this wrong somehow. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |3.2.3 3.3.3 3.4.0 3.5.0
      Known to work|                            |2.95
   Last reconfirmed|0000-00-00 00:00:00         |2004-07-27 23:12:21
               date|                            |
            Summary|Integer down cast ignored in|[3.3/3.4/3.5 regression]
                   |larger expression           |Integer down cast ignored in
                   |                            |larger expression
   Target Milestone|---                         |3.3.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16790


  parent reply	other threads:[~2004-07-27 23:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-27 22:35 [Bug c/16790] New: " andyb at mathworks dot com
2004-07-27 22:42 ` [Bug c/16790] " andyb at mathworks dot com
2004-07-27 23:03 ` pinskia at gcc dot gnu dot org
2004-07-27 23:12 ` bangerth at dealii dot org [this message]
2004-07-27 23:39 ` [Bug middle-end/16790] [3.3/3.4/3.5 regression] " pinskia at gcc dot gnu dot org
2004-08-03 21:24 ` cvs-commit at gcc dot gnu dot org
2004-08-07 21:57 ` [Bug middle-end/16790] [3.3/3.4 " cvs-commit at gcc dot gnu dot org
2004-08-07 22:03 ` [Bug middle-end/16790] [3.3 " pinskia at gcc dot gnu dot org
2004-08-08 18:55 ` cvs-commit at gcc dot gnu dot org
2004-08-08 18:57 ` 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=20040727231222.4150.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).