[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7o5nn52-nqn1-oo13-s6o9-59r85r91o768@fhfr.qr>
Date: Tue, 5 Apr 2022 11:58:33 +0200 (CEST)
From: Richard Biener <rguenther@...e.de>
To: Borislav Petkov <bp@...en8.de>
cc: linux-toolchains@...r.kernel.org, Michael Matz <matz@...e.de>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: older gccs and case labels producing integer constants
On Tue, 5 Apr 2022, 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?
I tried
void foo (int i)
{
switch (i)
{
case (((0xfc08) << 16) | (0x0101)):;
}
}
also with 'unsigned int i' but that's accepted with GCC 7. So
what do you switch on?
> Thx.
>
>
--
Richard Biener <rguenther@...e.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg)
Powered by blists - more mailing lists