<p>Try with valgrind. The compiler is probably initializing a variable only at -O0.</p>
<p><blockquote type="cite">On May 16, 2011 8:28 AM, &quot;Clemens Domanig&quot; &lt;<a href="mailto:clemens.domanig@uibk.ac.at">clemens.domanig@uibk.ac.at</a>&gt; wrote:<br><br>Hi everyone,<br>
<br>
maybe someone can explain to me what is going wrong with my code.<br>
<br>
In my programm I read values from a vector A and write them at new positions into a vector B. This works well as long as I don&#39;t use any optimization-flags when compiling the code. If I use -O1/2/3 the petsc tells me: &quot;out of range error&quot; at VecSetValue.<br>

It always happens at the some position although I&#39;m doing this kind of operations at different places again.<br>
<br>
petsc-version 3.1.6<br>
g++-version: gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)<br>
<br>
Thx for your help - C. Domanig<br>
</blockquote></p>