Skip to content

Commit

Permalink
[CAGE] libffi: Initialize nci_arg_ptr if !nci->arity
Browse files Browse the repository at this point in the history
clang 3.1 svn160959 properly caught:

src/nci/libffi.c:543:9: warning: variable 'nci_arg_ptr' is used uninitialized whenever 'if' condition is false
      [-Wsometimes-uninitialized]
    if (nci->arity) {
        ^~~~~~~~~~
src/nci/libffi.c:645:64: note: uninitialized use occurs here
    ffi_call(&thunk->cif, FFI_FN(nci->orig_func), return_data, nci_arg_ptr);
                                                               ^~~~~~~~~~~
src/nci/libffi.c:543:5: note: remove the 'if' if its condition is always true
    if (nci->arity) {
    ^~~~~~~~~~~~~~~~
src/nci/libffi.c:483:31: note: initialize the variable 'nci_arg_ptr' to silence this warning
    void         **nci_arg_ptr; /* pointers to arguments for libffi */
                              ^
                               = NULL
  • Loading branch information
Reini Urban committed Jul 31, 2012
1 parent c58b5b9 commit 2c139c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nci/libffi.c
Expand Up @@ -480,7 +480,7 @@ call_ffi_thunk(PARROT_INTERP, ARGMOD(PMC *nci_pmc), ARGMOD(PMC *self))
parrot_var_t *pcc_arg; /* values of pcc arguments */
nci_var_t *nci_val; /* values of nci arguments */
void **nci_arg; /* pointers for pass-by-ref arguments */
void **nci_arg_ptr; /* pointers to arguments for libffi */
void **nci_arg_ptr = NULL; /* pointers to arguments for libffi */

void *return_data; /* Holds return data from FFI call */
int i;
Expand Down

0 comments on commit 2c139c0

Please sign in to comment.