Thread (2 messages) flat view 2 messages, 2 authors, 2019-08-18

Re: [RFC PATCH] powerpc: use __builtin_trap() in BUG/WARN macros.

From: Segher Boessenkool <hidden>
Date: 2019-08-18 12:21:05
Also in: lkml

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help