xref: /illumos-gate/usr/src/tools/smatch/src/validation/bug-rshift-ub.c (revision c85f09cc92abd00c84e58ec9f0f5d942906cb713)
1*c85f09ccSJohn Levon enum a {
2*c85f09ccSJohn Levon 	A = ~0ULL,
3*c85f09ccSJohn Levon };
4*c85f09ccSJohn Levon 
5*c85f09ccSJohn Levon static enum a a = A;
6*c85f09ccSJohn Levon 
7*c85f09ccSJohn Levon /*
8*c85f09ccSJohn Levon  * check-name: bug-rshift-ub
9*c85f09ccSJohn Levon  * check-description:
10*c85f09ccSJohn Levon  *	This test trigger(ed) a bug on x86 caused by a
11*c85f09ccSJohn Levon  *	full width shift (which is UB), expecting to get
12*c85f09ccSJohn Levon  *	0 but giving the unshifted value and as result
13*c85f09ccSJohn Levon  *	the type is invalid:
14*c85f09ccSJohn Levon  *		warning: incorrect type in initializer (invalid types)
15*c85f09ccSJohn Levon  *			 expected bad type enum a static [toplevel] a
16*c85f09ccSJohn Levon  */
17