Re: [kvm-unit-tests PATCH] s390x: Ignore gcc 12 warnings for low addresses

Claudio Imbrenda
2022-05-18T05:17:59Z

On Tue, 17 May 2022 18:09:54 +0200
Thomas Huth <thuth@redhat.com> wrote:

> On 17/05/2022 14.02, Claudio Imbrenda wrote:
> > On Mon, 16 May 2022 16:43:32 +0200
> > Janis Schoetterl-Glausch <scgl@linux.ibm.com> wrote:
> >
> >> gcc 12 warns if a memory operand to inline asm points to memory in the
> >> first 4k bytes. However, in our case, these operands are fine, either
> >> because we actually want to use that memory, or expect and handle the
> >> resulting exception.
> >> Therefore, silence the warning.
> >
> > I really dislike this
>
> I agree the pragmas are ugly. But maybe we should mimic what the kernel
> is doing here?
>
> $ git show 8b202ee218395
> commit 8b202ee218395319aec1ef44f72043e1fbaccdd6
> Author: Sven Schnelle <svens@linux.ibm.com>
> Date: Mon Apr 25 14:17:42 2022 +0200
>
> s390: disable -Warray-bounds
>
> gcc-12 shows a lot of array bound warnings on s390. This is caused
> by the S390_lowcore macro which uses a hardcoded address of 0.
>
> Wrapping that with absolute_pointer() works, but gcc no longer knows
> that a 12 bit displacement is sufficient to access lowcore. So it
> emits instructions like 'lghi %r1,0; l %rx,xxx(%r1)' instead of a
> single load/store instruction. As s390 stores variables often
> read/written in lowcore, this is considered problematic. Therefore
> disable -Warray-bounds on s390 for gcc-12 for the time being, until
> there is a better solution.
>
> ... so we should maybe disable it in the Makefile, too, until the
> kernel folks found a nicer solution?

it's a bit extreme, but if it's good enough for the kernel, it's good
enough for us

>
> Thomas
>