codee-com / open-catalog

A collaborative effort to consolidate expert knowledge on code guidelines for the correctness, modernization, and optimization of code written in C, C++, and Fortran programming languages
https://open-catalog.codee.com/
Apache License 2.0
83 stars 9 forks source link

PWR024 #2

Closed forcegk closed 9 months ago

forcegk commented 9 months ago

The following loop is not in OpenMP canonical form because the iterator is initialized outside the loop: [...]

This can be easily fixed by removing the j increment and calculating it as a function of variable i.

void example(int **A, int n, int m) {
  for (int i = 0; i < n; i++) {
    A[i] = m;
  }
}

Which j increment? I think there might be a copy-paste type of error :)