xref: /illumos-gate/usr/src/tools/smatch/src/validation/Waddress-array.c (revision 241c90a06e8d1708235651863df515a2d522a03a)
1 int foo(void) {
2 	extern int a[];
3 
4 	if (a)
5 		return 1;
6 	return 0;
7 }
8 
9 int bar(void) {
10 	int a[2];
11 
12 	if (a)
13 		return 1;
14 	return 0;
15 }
16 
17 /*
18  * check-name: Waddress-array
19  * check-command: sparse -Wno-decl -Waddress $file
20  *
21  * check-error-start
22 Waddress-array.c:4:13: warning: the address of an array will always evaluate as true
23 Waddress-array.c:12:13: warning: the address of an array will always evaluate as true
24  * check-error-end
25  */
26