Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/c-c++-common/Warray-bounds-8.c @ 152:2b5abeee2509
update gcc11
author | anatofuz |
---|---|
date | Mon, 25 May 2020 07:50:57 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
145:1830386684a0 | 152:2b5abeee2509 |
---|---|
1 /* PR c/92326 - wrong bound in zero-length array diagnostics | |
2 { dg-do compile } | |
3 { dg-options "-O2 -Wall" } */ | |
4 | |
5 extern int a0[0]; | |
6 extern int ax[]; | |
7 | |
8 void warn_global_array (void) | |
9 { | |
10 a0[0] = 0; // { dg-warning "array bounds of 'int *\\\[0]'" } | |
11 ax[-1] = 0; // { dg-warning "array bounds of 'int *\\\[]'" } | |
12 } | |
13 | |
14 | |
15 struct S0 { int n, a0[0]; } s0; | |
16 struct Sx { int n, ax[]; } sx = { 0 }; | |
17 | |
18 void warn_member_array (void) | |
19 { | |
20 s0.a0[0] = 0; // { dg-warning "array bounds of 'int *\\\[0]'" } | |
21 sx.ax[0] = 0; // { dg-warning "array bounds of 'int *\\\[]'" } | |
22 } |