1 /* { dg-do compile } */
2 /* { dg-options "-std=c11" } */
3 /* Origin: Martin Uecker <uecker@eecs.berkeley.edu> */
5 void transpose0(double* out
, _Atomic
double* in
) { }
6 void transpose1(double out
[2][2], _Atomic
double in
[2][2]) { }
7 void transpose2(double out
[2][2][2], _Atomic
double in
[2][2][2]) { }
9 int (*x2(_Atomic
int x
[3][3]))[3] { return x
; } /* { dg-warning "returning '_Atomic int \\(\\*\\)\\\[3\\\]' from a function with incompatible return type" } */
10 _Atomic
int (*x3(int x
[3][3]))[3] { return x
; } /* { dg-warning "returning 'int \\(\\*\\)\\\[3\\\]' from a function with incompatible return type" } */
19 _Atomic
double z1
[2][2];
23 _Atomic
double z2
[2][2][2];
27 // passing as arguments
28 transpose0(y0
, x0
); /* { dg-warning "passing argument 2 of 'transpose0' from incompatible pointer type" } */
29 transpose1(y1
, o1
); /* { dg-warning "passing argument 2 of 'transpose1' from incompatible pointer type" } */
30 transpose1(y1
, x1
); /* { dg-warning "passing argument 2 of 'transpose1' from incompatible pointer type" } */
31 transpose2(y2
, o2
); /* { dg-warning "passing argument 2 of 'transpose2' from incompatible pointer type" } */
32 transpose2(y2
, x2
); /* { dg-warning "passing argument 2 of 'transpose2' from incompatible pointer type" } */
34 _Atomic
double (*x0p
) = x0
; /* { dg-warning "initialization of '_Atomic double \\*' from incompatible pointer type" } */
35 _Atomic
double (*x1p
)[2] = x1
; /* { dg-warning "initialization of '_Atomic double \\(\\*\\)\\\[2\\\]' from incompatible pointer type" } */
36 _Atomic
double (*x2p
)[2][2] = x2
; /* { dg-warning "initialization of '_Atomic double \\(\\*\\)\\\[2\\\]\\\[2\\\]' from incompatible pointer type" } */
38 x0p
= x0
; /* { dg-warning "assignment to '_Atomic double \\*' from incompatible pointer type" } */
39 x1p
= x1
; /* { dg-warning "assignment to '_Atomic double \\(\\*\\)\\\[2\\\]' from incompatible pointer type" } */
40 x2p
= x2
; /* { dg-warning "assignment to '_Atomic double \\(\\*\\)\\\[2\\\]\\\[2\\\]' from incompatible pointer type" } */
42 &(x0
[1]) - &(z0
[0]); /* { dg-error "invalid operands to binary" } */
43 &(x1
[1]) - &(z1
[0]); /* { dg-error "invalid operands to binary" } */
44 &(x2
[1]) - &(z2
[0]); /* { dg-error "invalid operands to binary" } */
46 x0
== z0
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
47 x1
== z1
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
48 x2
== z2
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
49 x0
> z0
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
50 x1
> z1
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
51 x2
> z2
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
52 x0
< z0
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
53 x1
< z1
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
54 x2
< z2
; /* { dg-warning "comparison of distinct pointer types lacks a cast" } */
55 // conditional expressions
56 (void)(1 ? x0
: z0
); /* { dg-warning "pointer type mismatch in conditional expression" } */
57 (void)(1 ? x1
: z1
); /* { dg-warning "pointer type mismatch in conditional expression" } */
58 (void)(1 ? x2
: z2
); /* { dg-warning "pointer type mismatch in conditional expression" } */