From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: linux-sparse@vger.kernel.org
Subject: Re: Undetected error cases
Date: Sun, 1 Jun 2008 20:55:32 +0200 [thread overview]
Message-ID: <19f34abd0806011155h7954c55fucabc091a419709a8@mail.gmail.com> (raw)
In-Reply-To: <19f34abd0806011142x7e56fd8gf51358bf606ede91@mail.gmail.com>
On Sun, Jun 1, 2008 at 8:42 PM, Vegard Nossum <vegard.nossum@gmail.com> wrote:
> 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:
>
Here are some more that all produce errors or at least warnings with
gcc but pass silently with sparse:
==> extern-struct.c <==
/* Empty declaration */
extern struct t {
};
==> inline-struct.c <==
/* "inline" has no meaning here. */
inline struct t {
};
==> struct-struct.c <==
/* What does this mean? */
struct struct {
};
==> struct-typedef.c <==
/* Anonymous typedef or struct named "typedef"? */
struct typedef {
};
==> typedef-cast.c <==
/* Cast to typedef doesn't make sense. */
static int x = (typedef int) 0;
==> typedef-struct.c <==
/* Anonymous typedef? */
typedef struct {
};
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 prev parent reply other threads:[~2008-06-01 18:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-01 18:42 Undetected error cases Vegard Nossum
2008-06-01 18:55 ` Vegard Nossum [this message]
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=19f34abd0806011155h7954c55fucabc091a419709a8@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).