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

Bug in Intel ICC V11.1 compiler?

jianni
Beginner
532 Views

I've run into what I believe to be a bug in Intel's standard C++ library implementation under linux-Intel64. I'd like to know if this is the case, or if I'm doing something incorrectly. I've managed to distill the problem into a short C++ source file (see below).

The attached program outputs the following on GCC and Intel:

> g++ test.cpp -o test.gcc

> icpc test.cpp -o test.icc

> ./test.gcc

(1,-1)

(2,-2)

(3,-3)

(4,-4)

> ./test.icc

(2.07468e-317,2.33291e-310)

(2.07468e-317,2.33291e-310)

(2.07468e-317,2.33291e-310)

(2.07468e-317,2.33291e-310)

The GCC results are what I would expect to get, the Intel results are completely wrong.

> icpc -v

Version 11.1

> cat test.cpp

#include

#include

#include

#include

#include

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

typedef std::complex< double > Complex;

std::vector< Complex > v;

v.push_back( Complex( 1, 1 ) );

v.push_back( Complex( 2, 2 ) );

v.push_back( Complex( 3, 3 ) );

v.push_back( Complex( 4, 4 ) );

std::transform( v.begin(), v.end(), v.begin(), std::conj< double > );

std::copy( v.begin(), v.end(),

std::ostream_iterator< Complex >( std::cout, "\\n" ) );

return 0;

}

Please advise.

Thanks.

0 Kudos
3 Replies
mecej4
Honored Contributor III
532 Views
There is something amiss with your setup. On Suse 11.1-amd64, I get
[bash]~/LANG> icpc -V cmplx.C
Intel C++ Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1    Build 20100203 Package ID: l_cproc_p_11.1.069
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.
FOR NON-COMMERCIAL USE ONLY

Edison Design Group C/C++ Front End, version 3.10.1 (Feb  3 2010 19:19:06)
Copyright 1988-2007 Edison Design Group, Inc.

GNU ld (GNU Binutils; devel:gcc / openSUSE_11.1) 2.20.0.20100122-33
$ ./a.out
(4,4)
(4,4)
(4,4)
(4,4)
[/bash]
0 Kudos
Judith_W_Intel
Employee
532 Views

It's not a problem in the standard library since Intel uses whatever library is on your system.

It looks like a compiler bug that is sensitive to inline level, i.e.:

sptxl8-23> icpc -inline-level=1 t.cpp && a.out
(1,-1)
(2,-2)
(3,-3)
(4,-4)
sptxl8-24> icpc -inline-level=2 t.cpp && a.out
(1.1267e-266,2.67007e-307)
(1.1267e-266,2.67007e-307)
(1.1267e-266,2.67007e-307)
(1.1267e-266,2.67007e-307)

I will make sure someoneenters this in our bug database.
It stillexists in our development compiler.

And thanks for the example.

Judy
0 Kudos
JenniferJ
Moderator
532 Views
Hello everyone,
this issue has been fixed and the fix is in the Intel C++ Composer XE update 2.

Please download it from the Registration Center.

Thanks,
Jennifer
0 Kudos
Reply