xref: /illumos-gate/usr/src/tools/smatch/src/validation/kill-load.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)

keep(volatile int * p)11f5207b7SJohn Levon int keep(volatile int *p)	{ return *p && 0; }
kill(int * p,int i)21f5207b7SJohn Levon int kill(int *p, int i)		{ return *p && 0; }
ind(volatile int * p,int i)31f5207b7SJohn Levon void ind(volatile int *p,int i)	{ int v = i++; if (i && 0) p[v]; }
41f5207b7SJohn Levon 
51f5207b7SJohn Levon 
61f5207b7SJohn Levon /*
71f5207b7SJohn Levon  * check-name: kill-load
81f5207b7SJohn Levon  * check-command: test-linearize -Wno-decl $file
91f5207b7SJohn Levon  * check-description:
101f5207b7SJohn Levon  *	Check that loads are optimized away but only
111f5207b7SJohn Levon  *	when needed:
121f5207b7SJohn Levon  *	- non-volatile
131f5207b7SJohn Levon  *	- bb unreachable.
141f5207b7SJohn Levon  *
151f5207b7SJohn Levon  * check-output-ignore
16*c85f09ccSJohn Levon  * check-output-pattern(1): load\\.
171f5207b7SJohn Levon  */
18