[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190818122036.GW31406@gate.crashing.org>
Date: Sun, 18 Aug 2019 07:20:36 -0500
From: Segher Boessenkool <segher@...nel.crashing.org>
To: Christophe Leroy <christophe.leroy@....fr>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [RFC PATCH] powerpc: use __builtin_trap() in BUG/WARN macros.
Hi Christophe,
On Sat, Aug 17, 2019 at 06:37:50PM +0000, Christophe Leroy wrote:
> #define BUG() do { \
> + __builtin_trap(); \
GCC will optimise away all code after this, it knows it is unreachable.
But you want to keep that BUG_ENTRY stuff I think?
The same will happen with a BUG_ON if the compiler can prove your
condition is always true.
> __asm__ __volatile__( \
> - "1: twi 31,0,0\n" \
> + "1:\n" \
> _EMIT_BUG_ENTRY \
> : : "i" (__FILE__), "i" (__LINE__), \
> "i" (0), "i" (sizeof(struct bug_entry))); \
(GCC wil generate a different trap btw; what is called "trap" as extended
mnemonic, that is, "tw 31,0,0", not the same thing as "twi", if that
matters for the exception handler).
Segher
Powered by blists - more mailing lists