changing array from ISGetIndices

Barry Smith bsmith at
Fri Sep 12 16:17:13 CDT 2008

On Sep 12, 2008, at 3:09 PM, Andrew T Barker wrote:

> The man page for ISGetIndices says "The user should NOT change the  
> indices."  But in this example
> around line 507 you do change indices you get from ISGetIndices.

     This is technically a bug, but since the IS is destroyed  
immediately afterwards, this should not cause a crash.

>  I'm trying to adapt this example to my own needs and am wondering  
> if this may be causing me problems.  In particular I go through this  
> section of code twice (to partition two chunks of data) and the  
> second time the ISCreateBlock makes a segfault.

     Whether this causes the problem or not depends on exactly what  
you are doing, if you are use the same IS etc.

     Recommend simply running in the debugger to see why it is  
crashing. Run the program with -start_in_debugger


I will fix petsc-dev so that ISGetIndices() uses a const and so the  
code will automatically detect this illegal use.

> Thanks,
> Andrew
> ---
> Andrew T. Barker
> andrew.barker at
> Applied Math Department
> University of Colorado, Boulder
> 526 UCB, Boulder, CO 80309-0526

More information about the petsc-users mailing list