Re: [PATCH 1/6] Kbuild: compile kernel with gnu11 std

From: Arnd Bergmann
Date: Tue Mar 01 2022 - 15:59:57 EST


On Tue, Mar 1, 2022 at 9:16 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Tue, Mar 1, 2022 at 10:00 AM kernel test robot <lkp@xxxxxxxxx> wrote:
> >
> > All warnings (new ones prefixed by >>):
> >
> > >> cc1: warning: result of '-117440512 << 16' requires 44 bits to represent, but 'int' only has 32 bits [-Wshift-overflow=]
>
> So that's potentially an interesting warning, but this email doesn't
> actually tell *where* that warning happens.
>
> I'm not entirely sure why this warning is new to this '-std=gnu11'
> change, but it's intriguing.
...
>
> Is there some place to actually see the full log (or some way to get a
> better pointer to just the new warning) to see that actual shift
> overflow thing?

gcc-11 only shows the one line warning here. The source is

/* PCI CFG04 status fields */
#define PCI_CFG04_STAT_BIT 16
#define PCI_CFG04_STAT 0xffff0000
#define PCI_CFG04_STAT_66_MHZ (1 << 21)
#define PCI_CFG04_STAT_FBB (1 << 23)
#define PCI_CFG04_STAT_MDPE (1 << 24)
#define PCI_CFG04_STAT_DST (1 << 25)
#define PCI_CFG04_STAT_STA (1 << 27)
#define PCI_CFG04_STAT_RTA (1 << 28)
#define PCI_CFG04_STAT_RMA (1 << 29)
#define PCI_CFG04_STAT_SSE (1 << 30)
#define PCI_CFG04_STAT_PE (1 << 31)
#define KORINA_STAT (PCI_CFG04_STAT_MDPE | \
PCI_CFG04_STAT_STA | \
PCI_CFG04_STAT_RTA | \
PCI_CFG04_STAT_RMA | \
PCI_CFG04_STAT_SSE | \
PCI_CFG04_STAT_PE)
#define KORINA_CNFG1 ((KORINA_STAT<<16)|KORINA_CMD)

unsigned int korina_cnfg_regs[25] = {
KORINA_CNFG1, /* ... */
};

This looks like an actual bug to me, the bits are shifted 16 bits twice
by accident, and it's been like this since rb532 was introduced in
2008.

Arnd