linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* variable size array declarations
@ 2011-10-31 14:08 Dan Carpenter
  2011-11-17  8:13 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-10-31 14:08 UTC (permalink / raw)
  To: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 618 bytes --]

I am trying to check something in Smatch with variable size arrays
and I'm running into problems.  Here is the function I'm trying to
parse.

void func(int x)
{
	char buf[x];
}

Array symbols have an ->array_size.  It gets set correctly in parse.c
to expression of type EXPR_SYMBOL.  But by the time I parse it in
Smatch the ->array_size is now an EXPR_PREOP (a dereference).  In
fact all the variables seem to get change to dereferences of the
variables.

So if I have:
	char buf[a + b + *c + 4];
Smatch gets:
	char buf[*a + *b + **c + 4];

I'm not sure where this is getting changed or why.

regards,
dan carpenter


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-17  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-31 14:08 variable size array declarations Dan Carpenter
2011-11-17  8:13 ` 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).