https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67359

            Bug ID: 67359
           Summary: struct-layout-1_generate.c undefined behaviour
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zeccav at gmail dot com
  Target Milestone: ---

Running struct-layout-1_generate.c the sanitized version of gcc finds two
undefined statements:

At line 1081

m &= (1ULL << e->len) - 1;

I get
/home/vitti/gcc-5.2.0/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c:1081:13:
runtime error: shift exponent 64 is too large for 64-bit type 'long long
unsigned int'

It seems that e->len == 64 and the shift is too large for 1ULL

At line 1901 

&& e[n].type < &complex_attrib_array_types[NAATYPES2])

should be

&& e[n].type < &complex_attrib_array_types[NCAATYPES2]) 

to avoid

/home/vitti/gcc-5.2.0/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c:1901:51:
runtime error: index 83 out of bounds for type 'types [54]'

Reply via email to