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

icpc: loop condition false inside the loop

$
0
0

I have been trying to debug a code for the last two weeks, and I have narrowed it down to this simple code which reproduces the issue.

#include <cassert>

template <class T>
class Vector{
 public:
  Vector(){dim=0;}
  ~Vector(){};
  inline int Dim() const{return dim;}
 private:
  int dim;
};

int main(int argc, char **argv){
  Vector<int> v;
  #pragma omp parallel for
  for(int trg=0;trg<v.Dim();trg++){
    assert(trg<v.Dim());
    Vector<int> vbuff[2];
  }
  return 0;
}

I compile the code with icpc version 12.1.6 as follows:

icpc -O0 -openmp main.cpp

When I run the executable, I get:

    a.out: main.cpp:17: int main(int, char **): Assertion `trg<v.Dim()' failed.

Can someone help me figure out what is going on?

Additional details: OS is Scientific Linux release 6.6 (Carbon). CPU is Intel(R) Xeon(R) CPU E5-2687W 0 @ 3.10GHz

Problema/Característica de Tce: 

Other

Viewing all articles
Browse latest Browse all 1616

Trending Articles



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