From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: Undetected error cases
Date: Sun, 1 Jun 2008 20:42:54 +0200 [thread overview]
Message-ID: <19f34abd0806011142x7e56fd8gf51358bf606ede91@mail.gmail.com> (raw)
Hi,
I was playing with sparse to see what it would accept, and I was
actually surprised at how many "obviously wrong" constructs it
accepted. Because sparse is supposed to warn about this, isn't it? Or
is there a policy not to warn about things that gcc already rejects?
If that were the case, I believe it would reduce the overall
usefulness of sparse.
(I say "obviously wrong" because I don't see how they can be valid,
but I might of course be mistaken :-))
Anyway, here are my test cases:
==> const-void.c <==
/* "const void" has no meaning. */
const void f(void);
==> extern-parameter.c <==
/* "extern" in parameter declaration has no meaning. */
void f(extern int x);
==> inline-parameter.c <==
/* "inline" in parameter declaration has no meaning. */
void f(inline int x);
==> inline-typedef.c <==
/* "inline" is in front of "typedef". Is this equivalent to
* "typedef inline int t"? Even so, it doesn't make sense to make variables
* inline. */
inline typedef t;
==> inline-variable.c <==
/* "inline" for variables has no meaning. */
static inline int x = 0;
==> typedef-collision.c <==
/* Two types with the same name. The second one is used, but should it
* be allowed? */
typedef char t;
typedef int t;
static t my_t = 0;
==> typedef-parameter.c <==
/* "typedef" in parameter declaration has no meaning. */
void f(typedef x);
None of these produce errors or even warnings when they are run
through sparse. I probably won't get around to fixing these myself
since I'm not that familiar with sparse internals. This is just a
heads up :-)
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
next reply other threads:[~2008-06-01 18:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-01 18:42 Vegard Nossum [this message]
2008-06-01 18:55 ` Undetected error cases Vegard Nossum
2008-06-01 18:58 ` Pavel Roskin
2008-06-01 19:46 ` Vegard Nossum
2008-06-01 20:10 ` Pavel Roskin
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=19f34abd0806011142x7e56fd8gf51358bf606ede91@mail.gmail.com \
--to=vegard.nossum@gmail.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).