Powered by Linux
Aw: Re: REGRESSION: implied: we have to make the false states match as well — Semantic Matching Tool

Aw: 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]

 



> Thanks for the bug report. I was just working on that code last week
> and I just pushed a fix right now.
> 
> commit 105d6766f7f2 ('implied: remove buggy code for working around the old fake_stree methods')

This fixed problems mentioned in my first mail but introduces new ones:

    cat << EOF > test.c
    struct bar {
    	void *x;
    };
    
    void doit(void);
    int checkit(void);
    struct bar *getit(void);
    
    #define WARNO(condition, format...) ({           \
             int __ret_warn_on = !!(condition);      \
             if (__ret_warn_on)    		        \
                     doit();        		  \
             __ret_warn_on; 	               \
     })
    
    struct lhead {
            struct lhead *next, *prev;
    };
    
    #define lfor_each(pos, head) \
             for (pos = (head)->next; pos != (head); pos = pos->next)
    
    
    void foo(struct lhead *head)
    {
    	struct lhead *h;
    	struct lhead *h2 = (void *)0;
    	struct bar *a;
    	struct bar *b = (void *)0;
    
    	lfor_each(h, head) {
    		if (checkit()) {
    			if (WARNO(h2, "foobaro"))
    				doit();
    			h2 = h;
    		}
    	}
    
    	a = getit();
    	if (a)
    		b = getit();
    
    	if (b)
    		b->x = a->x;
    }
    EOF
    smatch -p=kernel --two-passes test.c

This minimized version looks quite odd but it is even more odd that removing
a single unrelated looking line (like for example the lfor_each stuff or the
WARNO) will "fix" the warning:

    test.c:45 foo() error: we previously assumed 'a' could be null (see line 41)
--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux