discopop-project / discopop

DiscoPoP - Discovery of Potential Parallelism
http://www.discopop.org
BSD 3-Clause "New" or "Revised" License
39 stars 21 forks source link

False positive pragma generation #604

Open JShim-CS opened 3 months ago

JShim-CS commented 3 months ago

@lukasrothenberger

The following code generates a false-positive omp pragma for the last for loop in main. Pragma generated: " #pragma omp parallel for shared(Arr,N) reduction(+:w)"

#include <stdio.h>

int f(int i){
  if(i < 100000/2){
    return i + 100000/2;
  }else{
    return i;
  }
}

int g(int i){
  return i;
}

int main() {
  int N = 100000;
  int Arr[N];

  for (int i = 0; i < N; i++) {
    Arr[i] = 0;
  }

  long w = 0;

  for(int i = 0; i < N; i++){
    w += Arr[g(i)];
    Arr[f(i)] = 1;
  }

}
lukasrothenberger commented 2 months ago

Hi @JShim-CS, the reported false positive should be fixed in the linked branch. If you can find the time, could you please validate it? Best, Lukas

lukasrothenberger commented 2 months ago

Added to end-to-end tests in #627