lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: older gccs and case labels producing integer constants
On Tue, Apr 05, 2022 at 02:23:31PM +0200, Peter Zijlstra wrote:
> On Tue, Apr 05, 2022 at 11:50:35AM +0200, Borislav Petkov wrote:
> > Hi folks,
> >
> > I'm starting to see failures like this on allmodconfig builds:
> >
> > 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)):
> > ^~~~
> >
> > (The case statement is a macro but it evaluates to what I have there)
> >
> > and that thing fails with
> >
> > $ gcc --version
> > gcc (SUSE Linux) 7.5.0
> >
> > although it doesn't have any problems building with newer compilers.
> >
> > I'm presuming older gccs consider those case statements signed ints and
> > the following fixes it:
> >
> > case ((((unsigned int)0xfc08) << 16) | (0x0101)):
> >
> > and I guess we can whack the couple of occurrences but what I'm
> > wondering is why does this work with newer gccs?
>
> IIRC GCC-8 fixed a bunch of -wrapv issues. Could be this is one of them
> I suppose.

If we are talking about -fsanitize=shift -fwrapv, then that is
https://gcc.gnu.org/PR68418 , i.e. it was fixed already for GCC 6.

Jakub

\
 
 \ /
  Last update: 2022-04-06 16:18    [W:0.160 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site