Mercurial > hg > CbC > CbC_llvm
comparison clang/test/Sema/builtins-bpf.c @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 1d019706d866 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
1 // RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s | 1 // RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s |
2 | 2 |
3 struct s { int a; int b[4]; int c:1; }; | 3 struct s { |
4 union u { int a; int b[4]; int c:1; }; | 4 int a; |
5 int b[4]; | |
6 int c:1; | |
7 }; | |
8 union u { | |
9 int a; | |
10 int b[4]; | |
11 int c:1; | |
12 }; | |
13 typedef struct { | |
14 int a; | |
15 int b; | |
16 } __t; | |
17 typedef int (*__f)(void); | |
18 enum AA { | |
19 VAL1 = 10, | |
20 VAL2 = 0xffffffff80000000UL, | |
21 }; | |
22 typedef enum { | |
23 VAL10 = 10, | |
24 VAL11 = 11, | |
25 } __BB; | |
5 | 26 |
6 unsigned invalid1(const int *arg) { | 27 unsigned invalid1(const int *arg) { |
7 return __builtin_preserve_field_info(arg, 1); // expected-error {{__builtin_preserve_field_info argument 1 not a field access}} | 28 return __builtin_preserve_field_info(arg, 1); // expected-error {{__builtin_preserve_field_info argument 1 not a field access}} |
8 } | 29 } |
9 | 30 |
44 } | 65 } |
45 | 66 |
46 unsigned invalid11(struct s *arg, int info_kind) { | 67 unsigned invalid11(struct s *arg, int info_kind) { |
47 return __builtin_preserve_field_info(arg->a, info_kind); // expected-error {{__builtin_preserve_field_info argument 2 not a constant}} | 68 return __builtin_preserve_field_info(arg->a, info_kind); // expected-error {{__builtin_preserve_field_info argument 2 not a constant}} |
48 } | 69 } |
70 | |
71 unsigned valid12() { | |
72 const struct s t; | |
73 return __builtin_preserve_type_info(t, 0) + | |
74 __builtin_preserve_type_info(*(struct s *)0, 1); | |
75 } | |
76 | |
77 unsigned valid13() { | |
78 __t t; | |
79 return __builtin_preserve_type_info(t, 1) + | |
80 __builtin_preserve_type_info(*(__t *)0, 0); | |
81 } | |
82 | |
83 unsigned valid14() { | |
84 enum AA t; | |
85 return __builtin_preserve_type_info(t, 0) + | |
86 __builtin_preserve_type_info(*(enum AA *)0, 1); | |
87 } | |
88 | |
89 unsigned valid15() { | |
90 return __builtin_preserve_enum_value(*(enum AA *)VAL1, 1) + | |
91 __builtin_preserve_enum_value(*(enum AA *)VAL2, 1); | |
92 } | |
93 | |
94 unsigned invalid16() { | |
95 return __builtin_preserve_enum_value(*(enum AA *)0, 1); // expected-error {{__builtin_preserve_enum_value argument 1 invalid}} | |
96 } | |
97 | |
98 unsigned invalid17() { | |
99 return __builtin_preserve_enum_value(*(enum AA *)VAL10, 1); // expected-error {{__builtin_preserve_enum_value argument 1 invalid}} | |
100 } | |
101 | |
102 unsigned invalid18(struct s *arg) { | |
103 return __builtin_preserve_type_info(arg->a + 2, 0); // expected-error {{__builtin_preserve_type_info argument 1 invalid}} | |
104 } |