Re: older gccs and case labels producing integer constants
From: Michael Matz
Date: Tue Apr 05 2022 - 17:38:11 EST
On Tue, 5 Apr 2022, Peter Zijlstra wrote:
> > sound/usb/midi.c: In function ‘snd_usbmidi_out_endpoint_create’:
> > sound/usb/midi.c:1389:2: error: case label does not reduce to an integer constant
> > case (((0xfc08) << 16) | (0x0101)):
> > ^~~~
> IIRC GCC-8 fixed a bunch of -wrapv issues. Could be this is one of them
> I suppose.
Or better said, later GCCs returned back to the old behaviour of rejecting
this only with -pedantic even in the presence of -fsanitize. But
pedantically speaking (ahem!) it really isn't conforming c99 (which the
compilation flags claim) , and in this case it seems easy enough to make
the construct actually be conforming in the kernel sources, so that should
perhaps be done?