[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Sema / array-bounds-ptr-arith.c
blobfd2a00e9e8a4bf6c01c065683297a6e1bee0d806
1 // RUN: %clang_cc1 -verify -Warray-bounds-pointer-arithmetic %s
3 // Test case from PR10615
4 struct ext2_super_block{
5 unsigned char s_uuid[8]; // expected-note {{declared here}}
6 };
7 void* ext2_statfs (struct ext2_super_block *es,int a)
9 return (void *)es->s_uuid + sizeof(int); // no-warning
11 void* broken (struct ext2_super_block *es,int a)
13 return (void *)es->s_uuid + 80; // expected-warning {{refers past the end of the array}}
16 // Test case reduced from PR11594
17 struct S { int n; };
18 void pr11594(struct S *s) {
19 int a[10];
20 int *p = a - s->n;
23 // Test case reduced from <rdar://problem/11387038>. This resulted in
24 // an assertion failure because of the typedef instead of an explicit
25 // constant array type.
26 struct RDar11387038 {};
27 typedef struct RDar11387038 RDar11387038Array[1];
28 struct RDar11387038_Table {
29 RDar11387038Array z;
31 typedef struct RDar11387038_Table * TPtr;
32 typedef TPtr *TabHandle;
33 struct RDar11387038_B { TabHandle x; };
34 typedef struct RDar11387038_B RDar11387038_B;
36 void radar11387038(void) {
37 RDar11387038_B *pRDar11387038_B;
38 struct RDar11387038* y = &(*pRDar11387038_B->x)->z[4];
41 void pr51682 (void) {
42 int arr [1];
43 switch (0) {
44 case 0:
45 break;
46 case 1:
47 asm goto (""::"r"(arr[42] >> 1)::failed); // no-warning
48 break;
50 failed:;