You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typedefstructSS; // expected-note 4 {{forward declaration of 'struct S'}}
4
6
extern _Atomic(S*) e;
@@ -20,4 +22,11 @@ void a(S* b, void* c) {
20
22
d-=1; // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' (aka 'void (struct S *, void *)') is a GNU extension}}
21
23
(void)(1+d); // expected-warning {{arithmetic on a pointer to the function type 'void (S *, void *)' (aka 'void (struct S *, void *)') is a GNU extension}}
22
24
e++; // expected-error {{arithmetic on a pointer to an incomplete type}}
25
+
intptr_ti= (intptr_t)b;
26
+
char*f= (char*)0+i; // expected-warning {{arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension}}
27
+
// Cases that don't match the GNU inttoptr idiom get a different warning.
28
+
f= (char*)0-i; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}}
29
+
int*g= (int*)0+i; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}}
30
+
unsigned charj= (unsigned char)b;
31
+
f= (char*)0+j; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}}
0 commit comments