------- Comment #1 from pinskia at gmail dot com  2010-04-29 02:23 -------
Subject: Re:   New: gcc handle short overflow failed



Sent from my iPhone

On Apr 28, 2010, at 6:58 PM, "cnstar9988 at gmail dot com"
<gcc-bugzi...@gcc.gnu.org 
 > wrote:

> #include <string.h>
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
>  short i = 1;
>  int n = (int)(i << 16);
>
>  fprintf(stderr, "%d\n", n);
>
>  return 0;
> }
>
> always 65536
> it must to 0



No because short is promoted to int.
>
>
> -- 
>           Summary: gcc handle short overflow failed
>           Product: gcc
>           Version: unknown
>            Status: UNCONFIRMED
>          Severity: major
>          Priority: P3
>         Component: c
>        AssignedTo: unassigned at gcc dot gnu dot org
>        ReportedBy: cnstar9988 at gmail dot com
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43930
>


-- 


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

Reply via email to