This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add new built-in: __builtin_unreachable()


David Daney wrote:
Paolo Bonzini wrote:
int f(char *f)
{
  if (*f)
    __builtin_unreachable();
  return f ? 1 : 0;
}
f:
.LFB0:
    movl    $1, %eax
    ret

Sweet. Please add this as a testcase! (Just a target dependent one for 32-bit i386, scanning the assembler for no jmp and no occurrences of %e[bs]p, will be okay).



Could you explain why it is allowed to remove the trapping instruction?


If this were java (which admittedly it is not), that would not be allowed.

David Daney


Follow-up: If I use -fnon-call-exceptions, the trapping instruction is emitted.


David Daney


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]