When I run clang --analyze on PETSc on getting warnings of the type below, any
idea how to deal with them? Clearly these things are usually not null pointers
or PETSc would crash everywhere.
Thanks
Barry
12 warnings generated.
CC arch-debug/obj/src/mat/impls/aij/seq/bas/basfactor.o
CC arch-debug/obj/src/mat/impls/aij/seq/bas/spbas.o
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/bas/basfactor.c:33:11:
warning: Array access (from variable 'ui') results in a null pointer dereference
ui[0] = 0;
~~ ^
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/bas/basfactor.c:43:39:
warning: Dereference of null pointer
for (j=0; j<ncols; j++) *cols++ = *aj++;
~~~~~~~~^~~~~~~
2 warnings generated.
CC arch-debug/obj/src/mat/impls/aij/seq/csrperm/csrperm.o
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/csrperm/csrperm.c:190:23:
warning: Array access (from variable 'rows_in_bucket') results in a null
pointer dereference
rows_in_bucket[i] = 0;
~~~~~~~~~~~~~~ ^
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/csrperm/csrperm.c:194:5:
warning: Array access (from variable 'rows_in_bucket') results in a null
pointer dereference
rows_in_bucket[nz]++;
^~~~~~~~~~~~~~~~~~~~
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/csrperm/csrperm.c:221:27:
warning: Array access (via field 'xgroup') results in a null pointer dereference
aijperm->xgroup[ngroup] = istart;
~~~~~~ ^
3 warnings generated.
CC arch-debug/obj/src/mat/impls/aij/seq/ftn-auto/aijf.o
CC arch-debug/obj/src/mat/impls/aij/seq/crl/crl.o
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/crl/crl.c:62:20: warning:
Array access (from variable 'acols') results in a null pointer dereference
acols[j*m+i] = *aa++;
~~~~~ ^
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/crl/crl.c:63:20: warning:
Array access (from variable 'icols') results in a null pointer dereference
icols[j*m+i] = *aj++;
~~~~~ ^
/Users/barrysmith/Src/PETSc/src/mat/impls/aij/seq/crl/crl.c:66:20: warning:
Array access (from variable 'acols') results in a null pointer dereference
acols[j*m+i] = 0.0;