- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am compiling the following code with icpc 12.1.2 20111128 as on RHEL6 64-bit.
> icpc -O2 -ansi_alias -fPIC test.cc > ./a.out (6.95323e-310,0) (5.5, 6.6)
Both results should be (5.5, 6.6).
Here is test.cc:
#include <complex> #include <iostream> void badComplex(double x, double y, std::complex<double>& result) { result = std::complex<double>(x,y); } std::complex<double> goodComplex(double x, double y) { std::complex<double> result(x,y); return result; } int main() { double x = 5.5; double y = 5.5; std::complex<double> badResult; badComplex(x, y, badResult); std::complex<double> goodResult = goodComplex(x, y); std::cerr << badResult << " " << goodResult << std::endl; return 0; }
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mason,
This is a bug that got fixed in the subsequent versions of 12.X. BTW, the latest version released is 15.X which you can upgrade as well?
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BTW, the link at https://software.intel.com/en-us/articles/older-version-product/?wapkw=ALL(older+versions+of+software.intel.com) describes how to download older vesions...
_Kittur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Strange result indeed. I suppose that reference to complex<double> badResult was pointing to uninitialized memory.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page