Re: REGRESSION: implied: we have to make the false states match as well

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

 



Here is the minified versions of the first function:

    cat << EOF > test.c
    struct bar {
    	void *y;
    };
    
    struct bar *getit(void);
    int doit(struct bar *x);
    void putit(struct bar *x);
    
    int foo(void)
    {
    	int ret = 0;
    	struct bar *x;
    
    	x = getit();
    	if (!x || x->y)
    		goto out;
    
    	ret = doit(x);
    
    out:
    	if (x)
    		putit(x);
    
    	return ret;
    }
    EOF
    smatch -p=kernel --two-passes test.c

The problem seems to disappear when removing the "|| x->y".

The minified version of the second function:

    cat << EOF > test.c
    void *getit(void);
    void doit(void);
    
    void foo(void)
    {
    	void *a = (void *)0;
    	void *b = (void *)0;
    	void *c = (void *)0;
    	int d = 0;
    
    	a = getit();
    	if (a) {
    		b = getit();
    		c = getit();
    	}
    
    	if (c)
    		d = 1;
    
    	if (a && b && c)
    		doit();
    
    	if (d)
    		doit();
    }
    EOF
    CHECK="smatch -p=kernel --two-passes" cgcc  -c -o test.o test.c

It works when removing the "if (c)" + the next line
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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