[petsc-dev] Zero sized VecSetValues

Pierre Jolivet jolivet at ann.jussieu.fr
Sat Dec 13 12:35:08 CST 2014


Hello Barry,
Thank you for the quick fix.

On a completely unrelated note, in commit 
bbe210f1929f67cd37937d8e6757679d89b1c592 that you pushed to master 
recently, you introduced an unused variable Vec xx.
Now if I do a make check, I end up with the somehow misleading message

*******************Error detected during compile or 
link!*******************
See http://www.mcs.anl.gov/petsc/documentation/faq.html
/mnt/space/SVN/petsc/src/snes/examples/tutorials ex19
*********************************************************************************

because of -Wunused-variable.

Could you please fix that ?

Thank you in advance,
Pierre

On 2014-12-13 05:50, Barry Smith wrote:
> Pierre,
> 
>    Please find attached a patch to fix this; after applying the patch 
> do
> 
> make gnumake
> 
> in the root PETSc directory and relink your code.
> 
>    Thanks for reporting the problem
> 
>   Barry
> 
> 
>> On Dec 12, 2014, at 7:16 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>> 
>>  Pierre,
>> 
>>    There is no rational, we will fix it.
>> 
>>  Barry
>> 
>> 
>>> On Dec 12, 2014, at 11:47 AM, Pierre Jolivet <jolivet at ann.jussieu.fr> 
>>> wrote:
>>> 
>>> Hello,
>>> Taking 
>>> http://www.mcs.anl.gov/petsc/petsc-current/src/vec/vec/examples/tutorials/ex2.c.html 
>>> and changing its 56th line from
>>> VecSetValues(x,1,&i,&one,ADD_VALUES);
>>> to
>>> VecSetValues(x,0,NULL,NULL,ADD_VALUES);
>>> yield the following error (at least --with-debug=1):
>>> [0]PETSC ERROR: --------------------- Error Message 
>>> --------------------------------------------------------------
>>> [0]PETSC ERROR: Invalid pointer
>>> [0]PETSC ERROR: Null Pointer: Parameter # 3
>>> 
>>> What is the rationale behind first checking the pointers, then doing 
>>> the work or lack thereof, instead of, first checking if there is some 
>>> work to do, and only then check the pointers (à la MPI) ?
>>> 
>>> Thank you for your help,
>>> Pierre
>> 



More information about the petsc-dev mailing list