linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Xi Wang <xi.wang@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>,
	smatch@vger.kernel.org, linux-sparse@vger.kernel.org
Subject: Re: buffer overflow check bug
Date: Fri, 22 Jun 2012 15:31:54 +0300	[thread overview]
Message-ID: <20120622123154.GA5333@mwanda> (raw)
In-Reply-To: <EA6DE3B9-8977-4135-89F0-34812CCE9FF6@gmail.com>

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

      reply	other threads:[~2012-06-22 12:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120622123154.GA5333@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=smatch@vger.kernel.org \
    --cc=xi.wang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).