From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-sparse@vger.kernel.org
Subject: variable size array declarations
Date: Mon, 31 Oct 2011 17:08:29 +0300 [thread overview]
Message-ID: <20111031140829.GD15494@mwanda> (raw)
[-- 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 --]
next reply other threads:[~2011-10-31 14:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-31 14:08 Dan Carpenter [this message]
2011-11-17 8:13 ` variable size array declarations Dan Carpenter
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=20111031140829.GD15494@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-sparse@vger.kernel.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 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).