Segfault-Inc / Multicorn

Data Access Library
https://multicorn.org/
PostgreSQL License
700 stars 145 forks source link

warning about uninitialized variable use #72

Closed schmiddy closed 10 years ago

schmiddy commented 10 years ago

I noticed this warning while compiling the latest git master with clang 3.5 on OS X:

src/query.c:215:6: warning: variable 'l' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
 if (list_length(opExpr->args) == 2)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/query.c:221:23: note: uninitialized use occurs here
 if (((((const Node*)(l))->type) == T_Var) &&bms_is_member(((Var *) l)->varno, base_relids)
                      ^
src/query.c:215:2: note: remove the 'if' if its condition is always true
 if (list_length(opExpr->args) == 2)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/query.c:210:9: note: initialize the variable 'l' to silence this warning
 Node *l,
        ^
         = 0

which seems like a legitimate complaint about the IsA() check of variable 'l' on line 221 of query.c, where 'l' might be uninitialized.

rdunklau commented 10 years ago

Thank you for this report, I should test using clang.