Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Icc not detecting duplicate variables in OMP target update clause

$
0
0

If you mention (accidentally) a variable twice in an OMP 4.0 target update clause icc 14.0.2 will not detect this and instead ignore it.

Sample Code:

#include <stdio.h>
#include <stdlib.h>

#pragma omp declare target
int x,y;
#pragma omp end declare target

int main (int argc, char *argv[]) {

  x = 4;
  y = 5;
  #pragma omp target update to(x,y)

  #pragma omp target
  printf("4=%d 5=%d\n",x,y);

  x = 8;
  y = 9;
  #pragma omp target update to(y,x,y)

  #pragma omp target
  printf("8=%d 9=%d\n",x,y); //Output is "8=8 9=5" (!!!!)

  return EXIT_SUCCESS;
}

See the 2nd printf.

This just caused me a lot of trouble as I had a huge update statement with one duplicate variable which silently messed up the whole program.

Please make this an error!


Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>