PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / 20041106-1.c
blobcba4a06f11a3154952646b2abd2ced942b41c0df
1 /* { dg-do run { target *-*-linux* *-*-gnu* *-*-solaris* } } */
2 /* { dg-options -O2 } */
4 #include <sys/types.h>
5 #include <sys/mman.h>
6 #include <unistd.h>
7 #include <stdlib.h>
9 struct S { long x __attribute__((packed)); }; /* { dg-warning "attribute ignored" "" { target default_packed } } */
10 volatile long sink;
12 void foo (struct S *s)
14 sink = s->x;
17 int main ()
19 size_t ps = getpagesize ();
20 char *ptr, *page;
21 struct S *s;
23 ptr = malloc (3*ps);
24 page = (char *)(((__UINTPTR_TYPE__)ptr + (ps - 1)) & -ps);
25 munmap (page + ps, ps);
27 s = (struct S *)(page + ps - sizeof(struct S));
28 foo(s);
30 return 0;