[LLVMdev] noreturn attribute on a call instruction vs noreturn on a function

Duncan Sands baldrick at free.fr
Wed Nov 28 08:05:24 PST 2012


Hi Kostya,

On 28/11/12 14:47, Kostya Serebryany wrote:
> Hi,
>
> Building the following C code I get a call instruction that has no noreturn
> attribute, while the function itself does have it.
>
> void foo(void **b) {
>    __builtin_longjmp(b, 1);
> }
>
>
> define void @_Z3fooPPv(i8** %b) noreturn nounwind uwtable {
> entry:
>    %0 = bitcast i8** %b to i8*
>    tail call void @llvm.eh.sjlj.longjmp(i8* %0)
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>    unreachable
> }
>
> declare void @llvm.eh.sjlj.longjmp(i8*) noreturn nounwind  <<<<<<<<<<<<<<<<<
>
>
> I've hit this in asan where it checks the noreturn attribute in the call
> instruction, but not in the function object.
> Who is wrong here? Should asan also check noreturn in the called function?

I think you should consider the call no-return if either the call or the
callee has the no-return attribute.

Ciao, Duncan.

>
> Thanks,
>
> --kcc
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list