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

What's triggering this bug? Where can I see the bug history?

andy_m_jost
Beginner
225 Views
Hi,

I'm trying to understand what appears to be a bug in icpc 9.x. I know this has been fixed in 11.x (don't know about 10.x) but I am, unfortunately, stuck on the older version for now. I have workarounds; I'm trying to undersand the nature of this problem, especially the conditions under which it occurs.

Consider this example, paying attention to funciton f, and the initialization of c:


#include
#include

typedef std::complex complex_t;

void f(complex_t & a, complex_t b) {
if (true) a = b;
else a = b; // <<<** DELETING THIS LINE ELIMINATES THE BUG **>>>
}

int main() {
complex_t a(1, -2);
complex_t b(3, -4);
complex_t c = a + b;

std::cout << "a: " << a << std::endl
<< "b: " << b << std::endl
<< "c: " << c << std::endl;
return 0;
}

[63] % /depot/intelcc-9.1.049/intel64/icc/bin/icpc -O0 b.c && a.out
a: (1,-2)
b: (3,-4)
c: (-1.99905,1.77965e-43)

[64] % /depot/intelcc-11.0.074/bin/intel64/icpc -O0 b.c && a.out
a: (1,-2)
b: (3,-4)
c: (4,-6)

[65] % g++ -O0 b.c && a.out
a: (1,-2)
b: (3,-4)
c: (4,-6)

[66] % g++ --version
g++ (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20)


Where does the garbage value for c come from? How in the world does the definition of f, which is not called, affect the value of c??

I assume that this is a known (and subsequently, fixed) bug. I need to know the conditions under which this occurs so that I can avoid it in the future. Right now, it's now at all clear.

Also, why isn't the Intel knowledge base searchable? We could have all saved ourselves a bit of trouble if I had had a way to search a full list of known bugs for icpc ver 9.x!

Thanks,
-Andy
0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
225 Views

Andy,

Try using function prototype

Jim Dempsey

void f(complex_t & a, complex_t b);

int main() {
complex_t a(1, -2);
complex_t b(3, -4);
complex_t c = a + b;

std::cout << "a: " << a << std::endl
<< "b: " << b << std::endl
<< "c: " << c << std::endl;
return 0;
}
void f(complex_t & a, complex_t b) {
if (true) a = b;
else a = b; // <<<** DELETING THIS LINE ELIMINATES THE BUG **>>>
}

0 Kudos
JenniferJ
Moderator
225 Views
Quoting - andy.m.jost
I assume that this is a known (and subsequently, fixed) bug. I need to know the conditions under which this occurs so that I can avoid it in the future. Right now, it's now at all clear.

Also, why isn't the Intel knowledge base searchable? We could have all saved ourselves a bit of trouble if I had had a way to search a full list of known bugs for icpc ver 9.x!

Thanks,
-Andy

As for known-issues, we're starting to publish them if the issues are likely common. This knowledge base is new and is clearly very useful.

For bugs that are fixed in each release or update, they're used to be posted in the "readme.txt" in our registration & download center along with the product pkg. Now we start posting the fixed bugs on our knowledge base like this one - http://software.intel.com/en-us/articles/intel-parallel-composer-fixes-list/; and this will be searchable with google.

Thanks!
Jennifer
0 Kudos
Reply