Defect in linearization of short circuit &&

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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);
        }
}

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux