1 // RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s
17 typedef int (*__f
)(void);
20 VAL2
= 0xffffffff80000000UL
,
27 unsigned invalid1(const int *arg
) {
28 return __builtin_preserve_field_info(arg
, 1); // expected-error {{__builtin_preserve_field_info argument 1 not a field access}}
31 unsigned invalid2(const int *arg
) {
32 return __builtin_preserve_field_info(*arg
, 1); // expected-error {{__builtin_preserve_field_info argument 1 not a field access}}
35 void *invalid3(struct s
*arg
) {
36 return __builtin_preserve_field_info(arg
->a
, 1); // expected-error {{incompatible integer to pointer conversion returning 'unsigned int' from a function with result type 'void *'}}
39 unsigned valid4(struct s
*arg
) {
40 return __builtin_preserve_field_info(arg
->b
[1], 1);
43 unsigned valid5(union u
*arg
) {
44 return __builtin_preserve_field_info(arg
->b
[2], 1);
47 unsigned valid6(struct s
*arg
) {
48 return __builtin_preserve_field_info(arg
->a
, 1);
51 unsigned valid7(struct s
*arg
) {
52 return __builtin_preserve_field_info(arg
->c
, 1ULL);
55 unsigned valid8(union u
*arg
) {
56 return __builtin_preserve_field_info(arg
->a
, 1);
59 unsigned valid9(union u
*arg
) {
60 return __builtin_preserve_field_info(arg
->c
, 'a');
63 unsigned invalid10(struct s
*arg
) {
64 return __builtin_preserve_field_info(arg
->a
, arg
); // expected-error {{__builtin_preserve_field_info argument 2 not a constant}}
67 unsigned invalid11(struct s
*arg
, int info_kind
) {
68 return __builtin_preserve_field_info(arg
->a
, info_kind
); // expected-error {{__builtin_preserve_field_info argument 2 not a constant}}
71 unsigned valid12(void) {
73 return __builtin_preserve_type_info(t
, 0) +
74 __builtin_preserve_type_info(*(struct s
*)0, 1);
77 unsigned valid13(void) {
79 return __builtin_preserve_type_info(t
, 1) +
80 __builtin_preserve_type_info(*(__t
*)0, 0);
83 unsigned valid14(void) {
85 return __builtin_preserve_type_info(t
, 0) +
86 __builtin_preserve_type_info(*(enum AA
*)0, 1);
89 unsigned valid15(void) {
90 return __builtin_preserve_enum_value(*(enum AA
*)VAL1
, 1) +
91 __builtin_preserve_enum_value(*(enum AA
*)VAL2
, 1);
94 unsigned invalid16(void) {
95 return __builtin_preserve_enum_value(*(enum AA
*)0, 1); // expected-error {{__builtin_preserve_enum_value argument 1 invalid}}
98 unsigned invalid17(void) {
99 return __builtin_preserve_enum_value(*(enum AA
*)VAL10
, 1); // expected-error {{__builtin_preserve_enum_value argument 1 invalid}}
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}}