Kostya Serebryany
2012-Nov-28 13:47 UTC
[LLVMdev] noreturn attribute on a call instruction vs noreturn on a function
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? Thanks, --kcc -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121128/c1573c88/attachment.html>
Duncan Sands
2012-Nov-28 16:05 UTC
[LLVMdev] noreturn attribute on a call instruction vs noreturn on a function
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 >
Kostya Serebryany
2012-Nov-29 08:58 UTC
[LLVMdev] noreturn attribute on a call instruction vs noreturn on a function
On Wed, Nov 28, 2012 at 8:05 PM, Duncan Sands <baldrick at free.fr> wrote:> 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. >Thanks, I've fixed this in asan pass. --kcc> > 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<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >> >> > ______________________________**_________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121129/bac1a260/attachment.html>
Nuno Lopes
2012-Nov-29 22:21 UTC
[LLVMdev] noreturn attribute on a call instruction vs noreturn on afunction
You can use CallInst::hasFnAttr(). It checks for attributes in the instruction and in the function decl. http://llvm.org/docs/doxygen/html/Instructions_8cpp_source.html#l00345 Nuno ----- Original Message -----> 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? > > Thanks, > > --kcc
Kostya Serebryany
2012-Nov-30 11:13 UTC
[LLVMdev] noreturn attribute on a call instruction vs noreturn on afunction
On Fri, Nov 30, 2012 at 2:21 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:> You can use CallInst::hasFnAttr(). It checks for attributes in the > instruction and in the function decl. >Indeed.... And we have bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); } and asan code called CI->doesNotReturn and it did not work, but now it works. Hmm. Anyway, thanks! --kcc> > http://llvm.org/docs/doxygen/**html/Instructions_8cpp_source.**html#l00345<http://llvm.org/docs/doxygen/html/Instructions_8cpp_source.html#l00345> > > Nuno > > > ----- Original Message ----- > >> 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? >> >> Thanks, >> >> --kcc >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121130/5d7cf682/attachment.html>
Seemingly Similar Threads
- [LLVMdev] noreturn attribute on a call instruction vs noreturn on a function
- [LLVMdev] noreturn attribute on a call instruction vs noreturn on a function
- [LLVMdev] can i avoid saving CSRs for functions with noreturn
- [LLVMdev] Possible typo in LoopUnrollPass.cpp
- [LLVMdev] _Znwm is not a builtin