Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* Interesting (?) failure case
@ 2020-04-09  4:02 Linus Torvalds
  2020-04-09  6:23 ` Luc Van Oostenryck
  0 siblings, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2020-04-09  4:02 UTC (permalink / raw)
  To: Luc Van Oostenryck; +Cc: Sparse Mailing-list

Try linearizing this with 'sparse', and see it fail miserably:

   int t(void)
   {
        goto inside;
        return 0 ?
                 ({ inside: return 3; 1; })
                :
                 2;
   }

I came up with that disgusting example after talking to Nick
Desaulniers about how sparse does some front-end optimizations early,
and it made me go "Hmm... What about.."

There are two reasonable approaches for the above:

 - return 3 (due to the "goto inside")

 - tell the user to pound sand for doing crazy things and jumping into
a statement expression from outside.

clang does #1. gcc does #2.

sparse does something bad, and just generates garbage silently.

             Linus

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

end of thread, other threads:[~2020-04-09 19:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-09  4:02 Interesting (?) failure case Linus Torvalds
2020-04-09  6:23 ` Luc Van Oostenryck
2020-04-09 16:51   ` Linus Torvalds
2020-04-09 19:34     ` Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox