Assignment 8: Out of bound access

Assignment 8: Out of bound access

by Erik Fabrizzi -
Number of replies: 0

Excuse me in advance if this is meant to be pseoudocode, but I think  snippet from assignment 8  is not valid C code.

#pragma omp parallel for schedule(static)
for(int j=0; j<N-2; ++j) 

    for(int i=1; i<M-1; ++i) 

                y[j][i] = c * (x[j][i-1] + x[j][i+1] + x[j+1][i] + x[j+2][i] + x[j-1][i]);

The highlited call is out of bound in the first iteration outer iteration. (it compiles and runs but is undefined behaviour to segfault).