Module Name: src Committed By: christos Date: Sun Mar 21 00:03:46 UTC 2010
Added Files: src/regress/usr.bin/xlint/lint1: test27.c Log Message: right shift of unsigned quantities with constant. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/regress/usr.bin/xlint/lint1/test27.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Added files: Index: src/regress/usr.bin/xlint/lint1/test27.c diff -u /dev/null src/regress/usr.bin/xlint/lint1/test27.c:1.1 --- /dev/null Sat Mar 20 20:03:46 2010 +++ src/regress/usr.bin/xlint/lint1/test27.c Sat Mar 20 20:03:46 2010 @@ -0,0 +1,23 @@ +// Test that type shifts that result to narrower types don't produce warnings. +void +foo(void) { + unsigned long l = 100; + unsigned long long ll = 100; + unsigned int i = 100; + unsigned short s = 100; + unsigned char c = 1; + + l = ll >> 32; +// i = ll >> 31; + i = ll >> 32; + s = ll >> 48; + c = ll >> 56; + s = i >> 16; + c = i >> 24; + c = s >> 8; + (void)≪ + (void)&l; + (void)&i; + (void)&s; + (void)&c; +}