freebsd-dev/contrib/netbsd-tests/usr.bin/xlint/lint1/d_shift_to_narrower_type.c
Enji Cooper 57718be8fa Import the NetBSD test suite from ^/vendor/NetBSD/tests/09.30.2014_20.45 ,
minus the vendor Makefiles

Provide directions for how to bootstrap the vendor sources in
FREEBSD-upgrade

MFC after 2 weeks
Discussed with: rpaulo
Sponsored by: EMC / Isilon Storage Division
2014-10-02 23:26:49 +00:00

25 lines
398 B
C

// 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;
}