linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Li <sparse@chrisli.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hannes Eder <hannes@hanneseder.net>,
	linux-sparse@vger.kernel.org,
	Nicholas Mc Guire <der.herr@hofr.at>
Subject: Re: [bug, bisected, -chrisl] Segfault at evaluate.c:341
Date: Thu, 19 Mar 2009 16:11:41 -0700	[thread overview]
Message-ID: <70318cbf0903191611i4ec1f5e5sa97ba53db3a7478c@mail.gmail.com> (raw)
In-Reply-To: <20090319220906.GG28946@ZenIV.linux.org.uk>

Thanks Al,

I will apply it later tonight.

If no one beats to me, I will try to add the warning for using preprocessor
directive inside macro expansion. It should be a better error message
than the current one.

Chris

On Thu, Mar 19, 2009 at 3:09 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Thu, Mar 19, 2009 at 09:52:50PM +0000, Al Viro wrote:
>> On Thu, Mar 19, 2009 at 01:04:20PM -0700, Christopher Li wrote:
>>
>> > We should stop the segfault though. I take a look at it. It seems that
>> > there is a SYM_NODE with base_type is NULL. I guess in some of
>> > the error path we result in an invalid AST three.
>>
>> We are getting some mess with K&R declarations.  Which is bloody likely
>> to be my fault; will check.
>
> Yeah...  It's an old b0rken handling of calls for K&R + changes that exposed
> that even worse.
>
> Status quo is restored by the patch below, but it's a stopgap - e.g.
> void f();
> void g(void)
> {
>        f(0, 0);
> }
> will warn about extra arguments as if we had void f(void); as sparse had
> been doing all along.  B0rken.
>
> Testcase for the segfault is
> void f(x, y);
> void g(void)
> {
>        f(0, 0);
> }
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> diff --git a/parse.c b/parse.c
> index b9b96ba..87f6264 100644
> --- a/parse.c
> +++ b/parse.c
> @@ -2323,6 +2323,7 @@ static struct token *identifier_list(struct token *token, struct symbol *fn)
>                sym->ident = token->ident;
>                token = token->next;
>                sym->endpos = token->pos;
> +               sym->ctype.base_type = &incomplete_ctype;
>                add_symbol(list, sym);
>                if (!match_op(token, ',') ||
>                    token_type(token->next) != TOKEN_IDENT ||
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-03-19 23:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-19 13:49 [bug, bisected, -chrisl] Segfault at evaluate.c:341 Hannes Eder
2009-03-19 14:46 ` Al Viro
2009-03-19 18:32   ` Nicholas Mc Guire
2009-03-19 18:38   ` Hannes Eder
2009-03-19 19:14     ` Al Viro
2009-03-19 20:04       ` Christopher Li
2009-03-19 21:52         ` Al Viro
2009-03-19 22:09           ` Al Viro
2009-03-19 23:11             ` Christopher Li [this message]
2009-03-21  4:40               ` Al Viro
2009-03-21 17:28                 ` Al Viro
2009-03-23  9:22                   ` Christopher Li

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=70318cbf0903191611i4ec1f5e5sa97ba53db3a7478c@mail.gmail.com \
    --to=sparse@chrisli.org \
    --cc=der.herr@hofr.at \
    --cc=hannes@hanneseder.net \
    --cc=linux-sparse@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).