* Re: buffer overflow check bug [not found] ` <CAHGf_=rNSUKPrV5yYyJ8KWbvHO4zAPU7Du4_9HbwW-HiLVbFiw@mail.gmail.com> @ 2012-06-18 19:53 ` Dan Carpenter 2012-06-18 20:04 ` Josh Triplett 2012-06-19 20:37 ` Xi Wang 0 siblings, 2 replies; 5+ messages in thread From: Dan Carpenter @ 2012-06-18 19:53 UTC (permalink / raw) To: KOSAKI Motohiro; +Cc: smatch, linux-sparse Gar... I have no idea. That seems like an issue in sparse. Does anyone know why MOD_NORETURN gets set for: extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); but not for: extern __attribute__ ((__noreturn__)) void my_exit(const char*, ...); GCC seems to accept both formats. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: buffer overflow check bug 2012-06-18 19:53 ` buffer overflow check bug Dan Carpenter @ 2012-06-18 20:04 ` Josh Triplett 2012-06-18 20:25 ` Dan Carpenter 2012-06-19 20:37 ` Xi Wang 1 sibling, 1 reply; 5+ messages in thread From: Josh Triplett @ 2012-06-18 20:04 UTC (permalink / raw) To: Dan Carpenter; +Cc: KOSAKI Motohiro, smatch, linux-sparse On Mon, Jun 18, 2012 at 10:53:44PM +0300, Dan Carpenter wrote: > Gar... I have no idea. That seems like an issue in sparse. > > Does anyone know why MOD_NORETURN gets set for: > extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); > > but not for: > extern __attribute__ ((__noreturn__)) void my_exit(const char*, ...); > > GCC seems to accept both formats. I wonder if the latter gets incorrectly parsed as though the attribute attached to "void" rather than "my_exit"? - Josh Triplett ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: buffer overflow check bug 2012-06-18 20:04 ` Josh Triplett @ 2012-06-18 20:25 ` Dan Carpenter 0 siblings, 0 replies; 5+ messages in thread From: Dan Carpenter @ 2012-06-18 20:25 UTC (permalink / raw) To: Josh Triplett; +Cc: KOSAKI Motohiro, smatch, linux-sparse On Mon, Jun 18, 2012 at 01:04:07PM -0700, Josh Triplett wrote: > On Mon, Jun 18, 2012 at 10:53:44PM +0300, Dan Carpenter wrote: > > Gar... I have no idea. That seems like an issue in sparse. > > > > Does anyone know why MOD_NORETURN gets set for: > > extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); > > > > but not for: > > extern __attribute__ ((__noreturn__)) void my_exit(const char*, ...); > > > > GCC seems to accept both formats. > > I wonder if the latter gets incorrectly parsed as though the attribute > attached to "void" rather than "my_exit"? > I put a: printf("%d %d token = %s\n", token->pos.line, token->pos.pos, token->ident->name); in handle_attributes() and it only prints when the attribute is at the end. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: buffer overflow check bug 2012-06-18 19:53 ` buffer overflow check bug Dan Carpenter 2012-06-18 20:04 ` Josh Triplett @ 2012-06-19 20:37 ` Xi Wang 2012-06-22 12:31 ` Dan Carpenter 1 sibling, 1 reply; 5+ messages in thread From: Xi Wang @ 2012-06-19 20:37 UTC (permalink / raw) To: Dan Carpenter; +Cc: KOSAKI Motohiro, smatch, linux-sparse On Jun 18, 2012, at 3:53 PM, Dan Carpenter wrote: > Gar... I have no idea. That seems like an issue in sparse. > > Does anyone know why MOD_NORETURN gets set for: > extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); > > but not for: > extern __attribute__ ((__noreturn__)) void my_exit(const char*, ...); > > GCC seems to accept both formats. Which version of sparse are you using? Everything looks good to me here. extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); extern __attribute__ ((__noreturn__)) void another_exit(const char*, ...); void foo(void) { my_exit(""); } void bar(void) { another_exit(""); } My backend "splay" emits: declare void @my_exit(i8*, ...) noreturn declare void @another_exit(i8*, ...) noreturn ... The noreturn attribute is set simply by: if (sym->ctype.modifiers & MOD_NORETURN) LLVMAddFunctionAttr(func, LLVMNoReturnAttribute); - xi ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: buffer overflow check bug 2012-06-19 20:37 ` Xi Wang @ 2012-06-22 12:31 ` Dan Carpenter 0 siblings, 0 replies; 5+ messages in thread From: Dan Carpenter @ 2012-06-22 12:31 UTC (permalink / raw) To: Xi Wang; +Cc: KOSAKI Motohiro, smatch, linux-sparse On Tue, Jun 19, 2012 at 04:37:20PM -0400, Xi Wang wrote: > On Jun 18, 2012, at 3:53 PM, Dan Carpenter wrote: > > > Gar... I have no idea. That seems like an issue in sparse. > > > > Does anyone know why MOD_NORETURN gets set for: > > extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); > > > > but not for: > > extern __attribute__ ((__noreturn__)) void my_exit(const char*, ...); > > > > GCC seems to accept both formats. > > Which version of sparse are you using? Everything looks good to me here. I'm on sparse 0.4.4. Which version are you on? > > extern void my_exit(const char*, ...) __attribute__ ((__noreturn__)); > extern __attribute__ ((__noreturn__)) void another_exit(const char*, ...); > void foo(void) { my_exit(""); } > void bar(void) { another_exit(""); } > > My backend "splay" emits: > > declare void @my_exit(i8*, ...) noreturn > declare void @another_exit(i8*, ...) noreturn > ... > > The noreturn attribute is set simply by: > > if (sym->ctype.modifiers & MOD_NORETURN) > LLVMAddFunctionAttr(func, LLVMNoReturnAttribute); Yep. I use the same test, but sym->ctype.modifiers is not set for me. The debug printf I added in handle_attributes() should have printed. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-22 12:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <4FDBA56F.8070106@gmail.com> [not found] ` <4FDEFCB1.7030800@gmail.com> [not found] ` <4FDF0AA5.6080905@gmail.com> [not found] ` <20120618113037.GI4400@mwanda> [not found] ` <4FDF1610.3000100@gmail.com> [not found] ` <20120618121726.GG13539@mwanda> [not found] ` <4FDF2036.4080908@gmail.com> [not found] ` <20120618134338.GJ4400@mwanda> [not found] ` <20120618181111.GH13539@mwanda> [not found] ` <CAHGf_=rNSUKPrV5yYyJ8KWbvHO4zAPU7Du4_9HbwW-HiLVbFiw@mail.gmail.com> 2012-06-18 19:53 ` buffer overflow check bug Dan Carpenter 2012-06-18 20:04 ` Josh Triplett 2012-06-18 20:25 ` Dan Carpenter 2012-06-19 20:37 ` Xi Wang 2012-06-22 12:31 ` Dan Carpenter
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).