hppa: Fix typos in 32-bit SFmode peephole2 patterns
[official-gcc.git] / gcc / testsuite / gcc.dg / builtin-object-size-5.c
blobd1ad761cb6924c34c8757e5566c9626356553550
1 /* { dg-do compile { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } */
2 /* { dg-options "-O2" } */
4 #ifndef N
5 # define N 0x40000000
6 #endif
8 typedef __SIZE_TYPE__ size_t;
9 extern void abort (void);
10 extern char buf[N];
12 void
13 test1 (size_t x)
15 char *p = &buf[8];
16 size_t i;
18 for (i = 0; i < x; ++i)
19 p = p + 4;
20 #ifdef __builtin_object_size
21 if (__builtin_object_size (p, 0) != sizeof (buf) - 8 - 4 * x)
22 #else
23 if (__builtin_object_size (p, 0) != sizeof (buf) - 8)
24 #endif
25 abort ();
28 void
29 test2 (size_t x)
31 char *p = &buf[8];
32 size_t i;
34 for (i = 0; i < x; ++i)
35 p = p + 4;
36 #ifdef __builtin_object_size
37 if (__builtin_object_size (p, 1) != sizeof (buf) - 8 - 4 * x)
38 #else
39 if (__builtin_object_size (p, 1) != sizeof (buf) - 8)
40 #endif
41 abort ();
44 void
45 test3 (size_t x)
47 char *p = &buf[8];
48 size_t i;
50 for (i = 0; i < x; ++i)
51 p = p + 4;
52 #ifdef __builtin_object_size
53 if (__builtin_object_size (p, 2) != sizeof (buf) - 8 - 4 * x)
54 #else
55 if (__builtin_object_size (p, 2) != 0)
56 #endif
57 abort ();
60 void
61 test4 (size_t x)
63 char *p = &buf[8];
64 size_t i;
66 for (i = 0; i < x; ++i)
67 p = p + 4;
68 #ifdef __builtin_object_size
69 if (__builtin_object_size (p, 3) != sizeof (buf) - 8 - 4 * x)
70 #else
71 if (__builtin_object_size (p, 3) != 0)
72 #endif
73 abort ();
76 void
77 test5 (void)
79 char *p = &buf[0x90000004];
80 if (__builtin_object_size (p + 2, 0) != 0)
81 abort ();
84 void
85 test6 (void)
87 char *p = &buf[-4];
88 if (__builtin_object_size (p + 2, 0) != 0)
89 abort ();
92 #ifdef __builtin_object_size
93 void
94 test7 (void)
96 char *buf2 = __builtin_malloc (8);
97 char *p = &buf2[0x90000004];
98 if (__builtin_object_size (p + 2, 0) != 0)
99 abort ();
101 #endif
103 /* { dg-final { scan-assembler-not "abort" } } */