lkml.org 
[lkml]   [2019]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-08-18 14:22    [W:0.030 / U:5.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site