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()


Paolo Bonzini wrote:

Does that then still work for the original intent to mark asms that never
return as such?

And do we get for


int f(char *f)
{
  if (*f)
    __builtin_unreachable ();
  return f ? 1 : 0;
}

no memory access and just a "return 1;"?

[daney@dd_xps junk]$ cat jj.c

int f(char *f)
{
if (*f)
__builtin_unreachable();
return f ? 1 : 0;
}
[daney@dd_xps junk]$ /home/daney/gccsvn/native-clean/gcc/xgcc -B/home/daney/gccsvn/native-clean/gcc/ -O2 -S jj.c
[daney@dd_xps junk]$ cat jj.s
.file "jj.c"
.text
.p2align 4,,15
.globl f
.type f, @function
f:
.LFB0:
.cfi_startproc
movl $1, %eax
ret
.cfi_endproc
.LFE0:
.size f, .-f
.ident "GCC: (GNU) 4.5.0 20090612 (experimental) [trunk revision 148409]"
.section .note.GNU-stack,"",@progbits



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