1 // RUN
: %clang_cc1 -verify -fsyntax-only %s
2 // RUN
: %clang_cc1 -Wconversion -verify -fsyntax-only -cl-std
=CL2.0 %s
3 // RUN
: %clang_cc1 -Wconversion -verify -fsyntax-only -cl-std
=CL3.0 -cl-ext
=-all %s
4 // RUN
: %clang_cc1 -Wconversion -verify -fsyntax-only -cl-std
=CL3.0 %s
11 global float
*glob_wrong_ty
;
12 typedef constant int const_int_ty
;
13 const_int_ty
*con_typedef
;
15 glob
= to_global
(glob, loc
);
16 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
17 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
19 // expected-error
@-
4{{too many arguments to function call
, expected
1, have
2}}
24 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
25 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
27 // expected-error
@-
4{{invalid argument x to function
: 'to_global
', expecting a generic pointer argument
}}
30 glob
= to_global
(con);
31 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
32 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
34 // expected-error
@-
4{{invalid argument con to function
: 'to_global
', expecting a generic pointer argument
}}
37 glob
= to_global
(con_typedef);
38 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
39 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
41 // expected-error
@-
4{{invalid argument con_typedef to function
: 'to_global
', expecting a generic pointer argument
}}
44 loc
= to_global
(glob);
45 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
46 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
48 // expected-error
@-
4{{assigning
'__global int
*' to
'__local int
*__private
' changes address space of pointer
}}
49 // expected-warning
@-
5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance
}}
52 loc
= to_private
(glob);
53 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
54 // expected-error
@-
2{{use of undeclared identifier
'to_private
'}}
56 // expected-error
@-
4{{assigning
'__private int
*' to
'__local int
*__private
' changes address space of pointer
}}
57 // expected-warning
@-
5{{passing non-generic address space pointer to to_private may cause dynamic conversion affecting performance
}}
61 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
62 // expected-error
@-
2{{use of undeclared identifier
'to_local
'}}
64 // expected-warning
@-
4{{passing non-generic address space pointer to to_local may cause dynamic conversion affecting performance
}}
67 priv
= to_global
(glob);
68 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
69 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
71 // expected-error
@-
4{{assigning
'__global int
*' to
'__private int
*__private
' changes address space of pointer
}}
72 // expected-warning
@-
5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance
}}
75 priv
= to_private
(glob);
76 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
77 // expected-error
@-
2{{use of undeclared identifier
'to_private
'}}
79 // expected-warning
@-
4{{passing non-generic address space pointer to to_private may cause dynamic conversion affecting performance
}}
83 priv
= to_local
(glob);
84 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
85 // expected-error
@-
2{{use of undeclared identifier
'to_local
'}}
87 // expected-error
@-
4{{assigning
'__local int
*' to
'__private int
*__private
' changes address space of pointer
}}
88 // expected-warning
@-
5{{passing non-generic address space pointer to to_local may cause dynamic conversion affecting performance
}}
91 glob
= to_global
(glob);
92 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
93 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
95 // expected-warning
@-
4{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance
}}
98 glob
= to_private
(glob);
99 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
100 // expected-error
@-
2{{use of undeclared identifier
'to_private
'}}
102 // expected-error
@-
4{{assigning
'__private int
*' to
'__global int
*__private
' changes address space of pointer
}}
103 // expected-warning
@-
5{{passing non-generic address space pointer to to_private may cause dynamic conversion affecting performance
}}
106 glob
= to_local
(glob);
107 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
108 // expected-error
@-
2{{use of undeclared identifier
'to_local
'}}
110 // expected-error
@-
4{{assigning
'__local int
*' to
'__global int
*__private
' changes address space of pointer
}}
111 // expected-warning
@-
5{{passing non-generic address space pointer to to_local may cause dynamic conversion affecting performance
}}
114 global char
*glob_c
= to_global
(loc);
115 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
116 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
118 // expected-warning
@-
4{{incompatible pointer types initializing
'__global char
*__private
' with an expression of type
'__global int
*'}}
119 // expected-warning
@-
5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance
}}
122 glob_wrong_ty
= to_global
(glob);
123 #if
(__OPENCL_C_VERSION__ < CL_VERSION_2_0
) ||
(__OPENCL_C_VERSION__ >= CL_VERSION_3_0
&& !defined
(__opencl_c_generic_address_space))
124 // expected-error
@-
2{{use of undeclared identifier
'to_global
'}}
126 // expected-warning
@-
4{{incompatible pointer types assigning to
'__global float
*__private
' from
'__global int
*'}}
127 // expected-warning
@-
5{{passing non-generic address space pointer to to_global may cause dynamic conversion affecting performance
}}