This is only an issue on GCC versions prior to 4.4, this was fixed in GCC 4.5.
Is it possible to tell the compiler the variable used in a switch fits within the provided
Have you tried declaring the switch variable as a bitfield?
switch
struct Container { uint16_t a:3; uint16_t unused:13; }; struct Container cont; cont.a = 5; /* assign some value */ switch( cont.a ) { ... }
Hope this works!