Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

intel's valarray operator-() acts in reverse, opposite results with g++ and icpc

Gokul_H_
Beginner
522 Views

Hi, something seems not right with the functioning of in intel's valarray implementation. I tried using both the previous compilers as well as the most recent 2017 version of icpc. For instance, when we compile with icpc, we find that 0.1 - 0.05 = -0.05, instead of 0.1-0.05 = 0.05. g++ works fine though. Please find attached an example C++ file, and the makefile. Note that the makefile has a .txt extension that needs to be removed, or copy paste its contents in the terminal.

0 Kudos
4 Replies
Judith_W_Intel
Employee
522 Views

 

Is it only a problem when you use the  -use-intel-optimized-headers switch?

I had to remove the switch because it wouldn't compile for me and I don't see the problem without it.

 

ptel42-80> make -f makefile.save
icpc -use-intel-optimized-headers simple.cpp -I/opt/intel/mkl/include  -L/opt/intel/mkl/lib -Wl,-rpath,/opt/intel/mkl/lib -lmkl_rt -lm
In file included from /rdrive/crunlib/mainline_20170707/efi2/linux_test/include/perf_headers/c++/valarray(47),
                 from simple.cpp(5):
/rdrive/crunlib/mainline_20170707/efi2/linux_test/include/perf_headers/c++/ippvalarray(37): catastrophic error: cannot open source file "ipp.h"
  #include <ipp.h>
                  ^

compilation aborted for simple.cpp (code 4)

Normally we would just the valarray from GNU but it looks like with that switch we have our own version of valarray.

 

 

0 Kudos
Judith_W_Intel
Employee
522 Views

 

I created a bug report (cmplrs-44937) to track this issue. Thanks for reporting it.

0 Kudos
Gokul_H_
Beginner
522 Views

Sorry about the slightly wrong report, I thought I was using the 2017 version of Intel compiler, while I was using the 2015 version. Everything seems to work fine with the 2017 version. I think this must have already been addressed.

Without the flags -use-intel-optimized-headers I believe we use only GNU's version of valarray (according to Intel's documentation), and GNU's version seems okay for this case, as compiling with g++/gcc produces right results.

 

0 Kudos
Judith_W_Intel
Employee
522 Views

 

ok thanks for the additional info. I will close the report.

 

Judy

0 Kudos
Reply