This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/34235] short variable cast to unsigned int fails to right shift as unsigned



------- Comment #5 from rguenth at gcc dot gnu dot org  2008-01-25 22:58 -------
Confirmed.

extern "C" void abort (void);
int main()
{
        short x = -1;
        unsigned int c = ((unsigned int)x) >> 1;
        if (c != 0x7fffffff)
          abort();
        return 0;
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|c                           |c++
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-25 22:58:31
               date|                            |


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]