Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 2797

bug report [icc version 12.1.3] extern inside openmp block

$
0
0

Hello,

Let's we have two files extern.cpp and main.cpp

extern.cpp:

---------------

double e;

--------------

main.cpp

----------------------------

#include <iostream>
using namespace std;

void set()
{
   extern double e;
   e = 10;
}

int main()
{
   set();
#pragma omp parallel for
   for (int i = 0 ; i < 10 ; i++)
     {
        extern double e;
        cout<<e<<endl;
     }
}

-------------------------

after compilation: icc main.cpp extern.cpp -openmp, program print zeros. For some reason e inside loop became equal 0.

Cheers,

Sergey

AttachmentSize
Downloadextern.cpp11 bytes
Downloadmain.cpp224 bytes

Viewing all articles
Browse latest Browse all 2797


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