"Mark F. Adams" <[email protected]> writes:

>>> 
>>> No idea.  Do you want me to find out?  What should a general IS return
>>> as 'start'? 
>> 
>> ISStrideGetInfo does not dispatch through dynamically registered functionals.
>> 
>> PetscErrorCode  ISStrideGetInfo(IS is,PetscInt *first,PetscInt *step)
>> {
>>  IS_Stride *sub;
>> 
>>  PetscFunctionBegin;
>>  PetscValidHeaderSpecific(is,IS_CLASSID,1);
>>  if (first) PetscValidIntPointer(first,2);
>>  if (step) PetscValidIntPointer(step,3);
>> 
>>  sub = (IS_Stride*)is->data;
>>  if (first) *first = sub->first;
>>  if (step)  *step  = sub->step;
>>  PetscFunctionReturn(0);
>> }
>> 
>
>
> As I said earlier sub->first is 1 for ISGeneral, apparently.  

It is an invalid memory access because ISStrideGetInfo casts to an
IS_Stride without checking that the IS type matches.  I.e., this is a
serious bug.  We normally use dynamically composed functions to make
this safe.

> This is a sort of sensible number.  

Nonsense!  PETSc and C both use 0-based indexing consistently.  This is
not a Fortran interface.

> Is there an enum for 'crazy'?  or perhaps I can change sub->first to
> be -1 in ISGeneral and then return an error here if (*first < 0) …

Attachment: pgpRRHXq5aPui.pgp
Description: PGP signature

Reply via email to