------- Comment #2 from regehr at cs dot utah dot edu  2009-06-09 19:10 -------
Ah.. promotion to int trumps the casts to unsigned.  Thanks and sorry for the
spurious report.

(In reply to comment #1)
> Subject: Re:   New: possible integer wrong code bug
> 
> On Tue, 9 Jun 2009, regehr at cs dot utah dot edu wrote:
> 
> > reg...@john-home:~$ cat foo.c
> > #include <stdio.h>
> > 
> > int foo(int y)
> > {
> >   return (((unsigned short)y*(unsigned short)-2)>=(y?0:y));
> 
> This involves a signed integer overflow, 65534*65534.  -Wstrict-overflow=3 
> warns you about this.
> 


-- 

regehr at cs dot utah dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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

Reply via email to