Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/builtin-object-size-5.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do compile { target i?86-*-linux* i?86-*-gnu* x86_64-*-linux* } } */ | |
2 /* { dg-options "-O2" } */ | |
3 | |
4 typedef __SIZE_TYPE__ size_t; | |
5 extern void abort (void); | |
6 extern char buf[0x40000000]; | |
7 | |
8 void | |
9 test1 (size_t x) | |
10 { | |
11 char *p = &buf[8]; | |
12 size_t i; | |
13 | |
14 for (i = 0; i < x; ++i) | |
15 p = p + 4; | |
16 if (__builtin_object_size (p, 0) != sizeof (buf) - 8) | |
17 abort (); | |
18 } | |
19 | |
20 void | |
21 test2 (size_t x) | |
22 { | |
23 char *p = &buf[8]; | |
24 size_t i; | |
25 | |
26 for (i = 0; i < x; ++i) | |
27 p = p + 4; | |
28 if (__builtin_object_size (p, 1) != sizeof (buf) - 8) | |
29 abort (); | |
30 } | |
31 | |
32 void | |
33 test3 (size_t x) | |
34 { | |
35 char *p = &buf[8]; | |
36 size_t i; | |
37 | |
38 for (i = 0; i < x; ++i) | |
39 p = p + 4; | |
40 if (__builtin_object_size (p, 2) != 0) | |
41 abort (); | |
42 } | |
43 | |
44 void | |
45 test4 (size_t x) | |
46 { | |
47 char *p = &buf[8]; | |
48 size_t i; | |
49 | |
50 for (i = 0; i < x; ++i) | |
51 p = p + 4; | |
52 if (__builtin_object_size (p, 3) != 0) | |
53 abort (); | |
54 } | |
55 | |
56 /* { dg-final { scan-assembler-not "abort" } } */ |