From: Guenter Roeck <linux@roeck-us•net>
To: Randy Dunlap <rdunlap@infradead•org>,
Naresh Kamboju <naresh.kamboju@linaro•org>,
Linux-Next Mailing List <linux-next@vger•kernel.org>,
open list <linux-kernel@vger•kernel.org>,
lkft-triage@lists•linaro.org, linux-usb@vger•kernel.org
Cc: Stephen Rothwell <sfr@canb•auug.org.au>,
Greg Kroah-Hartman <gregkh@linuxfoundation•org>,
heikki.krogerus@linux•intel.com
Subject: Re: drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant
Date: Thu, 21 Apr 2022 16:18:14 -0700 [thread overview]
Message-ID: <0d9aff44-d41b-dabd-4d49-dd80631a4361@roeck-us.net> (raw)
In-Reply-To: <c86e540f-6611-4ef9-9439-8285fee61831@infradead.org>
On 4/21/22 15:27, Randy Dunlap wrote:
> Hi--
>
> On 4/21/22 13:36, Guenter Roeck wrote:
>> On 4/21/22 12:03, Naresh Kamboju wrote:
>>> Linux mainline and linux next arm64 builds failed with gcc-7.3.x.
>>>
>>> drivers/usb/typec/tcpm/tcpm.c: In function 'run_state_machine':
>>> drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not
>>> reduce to an integer constant
>>> case BDO_MODE_TESTDATA:
>>> ^~~~
>>> make[4]: *** [scripts/Makefile.build:288: drivers/usb/typec/tcpm/tcpm.o] Error 1
>>> ^
>>> Reported-by: Linux Kernel Functional Testing <lkft@linaro•org>
>>>
>>> --
>>
>> That code is several years old, the define is a constant, and I don't see
>> a recent change in the code. What am I missing ?
>
> See a recent patch for the same problem in a different area:
>
> commit 1ef8715975de
> Author: Borislav Petkov <bp@suse•de>
> Date: Tue Apr 5 17:15:08 2022 +0200
>
> ALSA: usb-audio: Fix undefined behavior due to shift overflowing the constant
>
> so those constants probably need to be cast to unsigned int.
> (I guess)
>
Turns out other versions of gcc are "affected" as well.
$ cc -Wall -std=c11 -pedantic -pedantic-errors testc.c
testc.c: In function ‘main’:
testc.c:16:2: error: case label is not an integer constant expression [-Wpedantic]
16 | case BDO_MODE_TESTDATA:
| ^~~~
... but _only_ with "-std=c11 -pedantic -pedantic-errors" or with "-fsanitize=shift".
It wants
#define BDO_MODE_TESTDATA (8u << 28)
Pedantic indeed ...
Guenter
prev parent reply other threads:[~2022-04-21 23:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 19:03 drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant Naresh Kamboju
2022-04-21 20:36 ` Guenter Roeck
2022-04-21 22:27 ` Randy Dunlap
2022-04-21 23:18 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d9aff44-d41b-dabd-4d49-dd80631a4361@roeck-us.net \
--to=linux@roeck-us$(echo .)net \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=heikki.krogerus@linux$(echo .)intel.com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=linux-usb@vger$(echo .)kernel.org \
--cc=lkft-triage@lists$(echo .)linaro.org \
--cc=naresh.kamboju@linaro$(echo .)org \
--cc=rdunlap@infradead$(echo .)org \
--cc=sfr@canb$(echo .)auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox