[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] compiler.h: Don't use compile-time assert when __NO_INLIN
From: |
Richard Henderson |
Subject: |
Re: [PATCH v2] compiler.h: Don't use compile-time assert when __NO_INLINE__ is defined |
Date: |
Sat, 15 Feb 2020 19:21:17 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 2/5/20 6:15 AM, Zenghui Yu wrote:
> Our robot reported the following compile-time warning while compiling
> Qemu with -fno-inline cflags:
>
> In function 'load_memop',
> inlined from 'load_helper' at /qemu/accel/tcg/cputlb.c:1578:20,
> inlined from 'full_ldub_mmu' at /qemu/accel/tcg/cputlb.c:1624:12:
> /qemu/accel/tcg/cputlb.c:1502:9: error: call to 'qemu_build_not_reached'
> declared with attribute error: code path is reachable
> qemu_build_not_reached();
> ^~~~~~~~~~~~~~~~~~~~~~~~
> [...]
>
> It looks like a false-positive because only (MO_UB ^ MO_BSWAP) will
> hit the default case in load_memop() while need_swap (size > 1) has
> already ensured that MO_UB is not involved.
>
> So the thing is that compilers get confused by the -fno-inline and
> just can't accurately evaluate memop_size(op) at compile time, and
> then the qemu_build_not_reached() is wrongly triggered by (MO_UB ^
> MO_BSWAP). Let's carefully don't use the compile-time assert when
> no functions will be inlined into their callers.
>
> Reported-by: Euler Robot <address@hidden>
> Suggested-by: Richard Henderson <address@hidden>
> Signed-off-by: Zenghui Yu <address@hidden>
> ---
>
> v2 is actually written by Richard Henderson.
>
> v1: https://lore.kernel.org/r/address@hidden
>
> include/qemu/compiler.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Queued to tcg-next.
r~