Shift overflow warnings in arch/powerpc/boot/addnote.c on 32-bit builds
Michael Ellerman
mpe at ellerman.id.au
Wed Mar 20 23:45:44 AEDT 2019
Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk> writes:
> Hi all,
>
> Whilst building the latest git master on my G4 I noticed the following shift overflow
> warnings in the build log for arch/powerpc/boot/addnote.c:
>
>
> arch/powerpc/boot/addnote.c: In function ‘main’:
> arch/powerpc/boot/addnote.c:75:47: warning: right shift count >= width of type
> [-Wshift-count-overflow]
> #define PUT_64BE(off, v)((PUT_32BE((off), (v) >> 32L), \
> ^~
> arch/powerpc/boot/addnote.c:72:39: note: in definition of macro ‘PUT_16BE’
> #define PUT_16BE(off, v)(buf[off] = ((v) >> 8) & 0xff, \
> ^
> arch/powerpc/boot/addnote.c:75:27: note: in expansion of macro ‘PUT_32BE’
> #define PUT_64BE(off, v)((PUT_32BE((off), (v) >> 32L), \
> ^~~~~~~~
> arch/powerpc/boot/addnote.c:94:50: note: in expansion of macro ‘PUT_64BE’
> #define PUT_64(off, v) (e_data == ELFDATA2MSB ? PUT_64BE(off, v) : \
> ^~~~~~~~
> arch/powerpc/boot/addnote.c:183:3: note: in expansion of macro ‘PUT_64’
> PUT_64(ph + PH_OFFSET, ns);
> ^~~~~~
I don't think there's any situation in which a 32-bit addnote will be
run against a 64-bit ELF is there?
So I don't think there's an actual bug, but it would be good if we could
make the warning go away.
cheers
More information about the Linuxppc-dev
mailing list