From: Christopher Li <sparse@chrisli.org>
To: Kamil Dudka <kdudka@redhat.com>
Cc: Pavel Roskin <proski@gnu.org>,
Josh Triplett <josh@joshtriplett.org>,
linux-sparse@vger.kernel.org
Subject: Re: Sparse crash when mixing int and enum in ternary operator
Date: Wed, 10 Mar 2010 13:56:15 -0800 [thread overview]
Message-ID: <70318cbf1003101356u48688264na5c9d71bc1ef4300@mail.gmail.com> (raw)
In-Reply-To: <201003101705.36304.kdudka@redhat.com>
On Wed, Mar 10, 2010 at 8:05 AM, Kamil Dudka <kdudka@redhat.com> wrote:
> On Wed March 10 2010 02:09:22 Pavel Roskin wrote:
>> I wonder is the quirk handling could be skipped for EXPR_SELECT, but I'm
>> fine with it if it's harmless.
>
> That's more likely question for sparse developers. I have no test-case which
> goes through the EXPR_SELECT path, so that I can't test it actually.
Hi, Sorry for the late reply. I did play with your patch yesterday.
I believe this is the code we are talking about:
+warn_for_enum_conversions(struct expression *expr, struct symbol *type)
+{
+ switch (expr->type) {
+ case EXPR_CONDITIONAL:
+ case EXPR_SELECT:
+ do_warn_for_enum_conversions(expr->cond_true
+ /* handle the "?:" quirk */
+ ?: expr->conditional,
+ type);
+ do_warn_for_enum_conversions(expr->cond_false, type);
+ break;
+
+ default:
+ do_warn_for_enum_conversions(expr, type);
+ }
+}
+
I feel that we shouldn't do special handling for EXPR_CONDITIONAL here.
We should just make the warn_for_enum_conversions more robust.
Special handing EXPR_CONDITIONAL here is just an one off thing.
What if there is a nested EXPR_CONDITIONAL inside the expr->cond_true?
See, your do_warn_for_enum_conversions() still need to handle
EXPR_CONDITIONAL any way. So I argue that we don't need that
special case for EXPR_CONDITIONAL here.
BTW, EXPR_SELECT only appear after expand stage. So you should not
see EXPR_SELECT in the evaluate stage.
Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-03-10 21:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-09 1:24 Sparse crash when mixing int and enum in ternary operator Pavel Roskin
2010-03-09 5:43 ` Christopher Li
2010-03-09 13:46 ` Kamil Dudka
2010-03-09 18:26 ` Pavel Roskin
2010-03-09 18:35 ` Pavel Roskin
2010-03-09 19:06 ` Kamil Dudka
2010-03-09 19:15 ` Josh Triplett
2010-03-09 20:11 ` Pavel Roskin
2010-03-09 20:29 ` Kamil Dudka
2010-03-09 23:30 ` Kamil Dudka
2010-03-10 1:09 ` Pavel Roskin
2010-03-10 16:05 ` Kamil Dudka
2010-03-10 20:27 ` Pavel Roskin
2010-03-10 20:44 ` Kamil Dudka
2010-03-10 21:03 ` Kamil Dudka
2010-03-10 21:56 ` Christopher Li [this message]
2010-03-13 17:22 ` Kamil Dudka
2010-03-21 15:27 ` Kamil Dudka
2010-03-24 10:07 ` Christopher Li
2010-03-24 10:51 ` Kamil Dudka
2010-03-27 9:16 ` Kamil Dudka
2010-03-27 9:29 ` Josh Triplett
2010-03-27 9:53 ` [PATCH] eliminate insane conversions from int to enum Kamil Dudka
2010-03-29 18:11 ` Christopher Li
2010-03-29 18:05 ` Sparse crash when mixing int and enum in ternary operator Christopher Li
2010-03-29 18:17 ` Kamil Dudka
2010-03-29 18:48 ` Christopher Li
2010-03-29 19:23 ` Kamil Dudka
2010-03-30 5:29 ` Pavel Roskin
2010-03-29 21:26 ` Josh Triplett
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=70318cbf1003101356u48688264na5c9d71bc1ef4300@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=josh@joshtriplett.org \
--cc=kdudka@redhat.com \
--cc=linux-sparse@vger.kernel.org \
--cc=proski@gnu.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).