Re: [PATCH] mm: vmap: avoid -Wsequence-point warning

From: Arnd Bergmann
Date: Thu Nov 04 2021 - 10:39:41 EST


On Thu, Nov 4, 2021 at 2:57 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
> On Thu, Nov 04, 2021 at 02:35:40PM +0100, Arnd Bergmann wrote:
> >
> > This only appeared in one randconfig build so far, and I don't know
> > what caused it, but moving the index increment out of the expression
> > at least addresses the warning.
>
> Would that randconfig include CONFIG_ARM64_PA_BITS_52?
>
> #define __phys_to_pte_val(phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK)
>
> because that's going to double-increment idx. Or single increment.
> Or whatever else the compiler feels like doing.

Ok, got it. I've got a new patch turning that into an inline function now,
which seems like a more reliable fix. I still don't see why the warning only
showed up now, as both the caller and the definition of __phys_to_pte_val()
are not that new, and I've been testing with gcc-11 for a while now.

Arnd