linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Defect in linearization of short circuit &&
@ 2010-02-14 13:39 Jacek Śliwerski
  2010-02-14 21:04 ` Jacek Śliwerski
  0 siblings, 1 reply; 18+ messages in thread
From: Jacek Śliwerski @ 2010-02-14 13:39 UTC (permalink / raw)
  To: linux-sparse

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

I am attaching a small sample of code that triggers an issue with the 
linearization of &&.  Consider the condition within the parser_check 
function.  If st == NULL, then no more checks should be performed; the 
execution flow should immediately be directed to the "else" branch. 
However, if you output linearized version (e.g. by using "example" 
program), you will notice that it only skips the second check.

Could you help me investigate this issue?

I am using the latest sparse version from git.

Thank you!
Jacek


[-- Attachment #2: parser_check.c --]
[-- Type: text/x-csrc, Size: 356 bytes --]

struct st {
        int value;
        struct st *other;
};

static void
execute_a (struct st *st, int i)
{
}

static void
execute_b (struct st *st)
{
}

static void
parser_check (struct st *st, int i)
{
        if (st && st->other && st->value > i && i > 0){
                execute_a (st, i);
        } else {
                execute_b (st);
        }
}

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

end of thread, other threads:[~2010-02-17 20:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-14 13:39 Defect in linearization of short circuit && Jacek Śliwerski
2010-02-14 21:04 ` Jacek Śliwerski
2010-02-14 23:09   ` Christopher Li
2010-02-15 19:12     ` Jacek Śliwerski
2010-02-15 19:41       ` Christopher Li
2010-02-15 20:18         ` Jacek Śliwerski
2010-02-15 21:11           ` Christopher Li
2010-02-16  9:28             ` Bernd Petrovitsch
2010-02-16 19:02               ` Christopher Li
2010-02-16 19:10                 ` Christopher Li
2010-02-16 19:19                 ` Jacek Śliwerski
2010-02-16 19:36                   ` Christopher Li
2010-02-16 20:11                     ` enum warning patch (was Re: Defect in linearization of short circuit &&) Kamil Dudka
2010-02-16 20:18                       ` Kamil Dudka
2010-02-16 22:44                         ` Christopher Li
2010-02-17 14:00                           ` Kamil Dudka
2010-02-17 11:47                 ` Defect in linearization of short circuit && Bernd Petrovitsch
2010-02-17 20:22                   ` Christopher Li

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).