All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Christopher Li <sparse@chrisli.org>
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 22:09:06 +0000	[thread overview]
Message-ID: <20090319220906.GG28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20090319215250.GF28946@ZenIV.linux.org.uk>

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 ||

  reply	other threads:[~2009-03-19 22:09 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 [this message]
2009-03-19 23:11             ` Christopher Li
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=20090319220906.GG28946@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=der.herr@hofr.at \
    --cc=hannes@hanneseder.net \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.