#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


-- 
           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

Reply via email to