* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
[official-gcc.git] / gcc / testsuite / gcc.dg / 20050826-1.c
blob7563ec7ef11aaf7b2e35bc55a57bf10611ab74e5
1 /* Test whether strncmp has not been "optimized" into memcmp
2 nor any code with memcmp semantics. */
3 /* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* alpha*-*-linux* powerpc*-*-linux* s390*-*-linux* sparc*-*-linux* i?86-*-darwin* powerpc-*-darwin*} } */
4 /* { dg-options "-O2" } */
5 #include <stddef.h>
6 #include <stdio.h>
7 #include <sys/mman.h>
8 /* Darwin spells this differently */
9 #ifndef MAP_ANONYMOUS
10 #define MAP_ANONYMOUS MAP_ANON
11 #endif
12 #include <stdlib.h>
14 struct Flags {
15 int filler[18];
16 unsigned int a:14;
17 unsigned int b:14;
18 unsigned int c:1;
19 unsigned int d:1;
20 unsigned int e:1;
21 unsigned int f:1;
23 static void __attribute__((noinline)) set (struct Flags *);
24 static void set (struct Flags *fp)
26 fp->b = 5;
27 fp->d = 1;
30 static int __attribute__((noinline)) bar (int);
31 static int bar(int x) { return !(x==1); }
32 int main (void)
34 char *p = mmap (NULL, 131072, PROT_READ | PROT_WRITE,
35 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
36 struct Flags *fp;
37 if (p == MAP_FAILED)
38 return 0;
39 if (munmap (p + 65536, 65536) < 0)
40 return 0;
41 fp = (struct Flags*)(p + 65536 - sizeof(struct Flags));
42 set(fp);
43 if (fp->b > 0)
44 return (bar(fp->d));
45 return 1;