[petsc-dev] technical C question
Jed Brown
jed at jedbrown.org
Thu Apr 7 17:56:47 CDT 2016
Satish Balay <balay at mcs.anl.gov> writes:
> On Thu, 7 Apr 2016, Jed Brown wrote:
>
>> Barry Smith <bsmith at mcs.anl.gov> writes:
>> > Should we caste to an unsigned PetscInt first then?
>>
>> It should be unsigned, yes. Does that fix the warning?
>
> Nope..
>
> Commenting out the following line - or changing the argument thus is
> making a difference.
>
> diff --git a/src/mat/impls/baij/seq/baijfact.c b/src/mat/impls/baij/seq/baijfact.c
> index fea37cb..e2c210c 100644
> --- a/src/mat/impls/baij/seq/baijfact.c
> +++ b/src/mat/impls/baij/seq/baijfact.c
> @@ -1081,7 +1081,7 @@ PetscErrorCode MatICCFactorSymbolic_SeqBAIJ(Mat fact,Mat A,IS perm,const MatFact
> ncols_upper++;
> }
> }
> - ierr = PetscIncompleteLLAdd(ncols_upper,cols,levels,cols_lvl,am,nlnk,lnk,lnk_lvl,lnkbt);CHKERRQ(ierr);
> + ierr = PetscIncompleteLLAdd(ncols,cols,levels,cols_lvl,am,nlnk,lnk,lnk_lvl,lnkbt);CHKERRQ(ierr);
That looks like it changes the semantics.
In any case, that file wasn't even mentioned in the message that Barry
shared. If it is indeed the same issue, then it would appear that the
static analyzer has determined that it is possible for index to be
negative.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160407/c195005d/attachment.sig>
More information about the petsc-dev
mailing list