linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant
@ 2022-04-21 19:03 Naresh Kamboju
  2022-04-21 20:36 ` Guenter Roeck
  0 siblings, 1 reply; 4+ messages in thread
From: Naresh Kamboju @ 2022-04-21 19:03 UTC (permalink / raw)
  To: Linux-Next Mailing List, open list, lkft-triage, linux-usb
  Cc: Stephen Rothwell, Greg Kroah-Hartman, heikki.krogerus, Guenter Roeck

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>

--
Linaro LKFT
https://lkft.linaro.org

https://ci.linaro.org/view/lkft/job/openembedded-lkft-linux-mainline/DISTRO=lkft,MACHINE=hikey,label=docker-buster-lkft/4259/consoleText

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2022-04-21 20:36 UTC (permalink / raw)
  To: Naresh Kamboju, Linux-Next Mailing List, open list, lkft-triage,
	linux-usb
  Cc: Stephen Rothwell, Greg Kroah-Hartman, heikki.krogerus

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 ?

Guenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant
  2022-04-21 20:36 ` Guenter Roeck
@ 2022-04-21 22:27   ` Randy Dunlap
  2022-04-21 23:18     ` Guenter Roeck
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2022-04-21 22:27 UTC (permalink / raw)
  To: Guenter Roeck, Naresh Kamboju, Linux-Next Mailing List,
	open list, lkft-triage, linux-usb
  Cc: Stephen Rothwell, Greg Kroah-Hartman, heikki.krogerus

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)

-- 
~Randy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drivers/usb/typec/tcpm/tcpm.c:4724:3: error: case label does not reduce to an integer constant
  2022-04-21 22:27   ` Randy Dunlap
@ 2022-04-21 23:18     ` Guenter Roeck
  0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2022-04-21 23:18 UTC (permalink / raw)
  To: Randy Dunlap, Naresh Kamboju, Linux-Next Mailing List, open list,
	lkft-triage, linux-usb
  Cc: Stephen Rothwell, Greg Kroah-Hartman, heikki.krogerus

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-21 23:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).