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

strange error with icpc for linux

pivo12
Beginner
854 Views

Hello,

compiling this tiny program, prog1.cpp:

int cos_sin();
int main()
{
int x = cos_sin();
}

I was getting this compiler error:

prog1.cpp(5): error: argument is incompatible with formal parameter
int x = cos_sin();

^

Intel C++ Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.4.191 Build 20110427
Copyright (C) 1985-2011 Intel Corporation.

Slackware Linux 64bit
Kernel version 2.6.37.6

What can I do to correct this?

Thanks.

Tamas Istvan

0 Kudos
1 Solution
Melanie_B_Intel
Employee
854 Views
There's no problem with your program, it's a bug in the compiler. I've filed an Intel-internal bug tracking report about it.

The bug in the compiler is that it mistakes cos_sin as an intrinsic, and ignores the function prototype. The suggested workaround is that you avoid using the identifier cos_sin.

Best regards, Melanie

View solution in original post

0 Kudos
5 Replies
Melanie_B_Intel
Employee
854 Views
This is a bug in the compiler, we're recognizing cos_sin as an intrinsic rather than a user-defined function. I filed cq172664 to track it. Thanks for reporting this problem.

I find that the bug is only active when compiling c++: compiling as a .c file with icc doesn't expose the problem. (mv prog1.cpp prog1.c ; icc -c prog1.c)
So workaround is to compile as a .c file, if possible. Or use a different identifier for the function name.
--Melanie Blower
C/C++ front end developer
0 Kudos
pivo12
Beginner
854 Views
Thanks for the answer. But what the problem with the 'cos_sin()' function name?
0 Kudos
Melanie_B_Intel
Employee
855 Views
There's no problem with your program, it's a bug in the compiler. I've filed an Intel-internal bug tracking report about it.

The bug in the compiler is that it mistakes cos_sin as an intrinsic, and ignores the function prototype. The suggested workaround is that you avoid using the identifier cos_sin.

Best regards, Melanie
0 Kudos
Judith_W_Intel
Employee
854 Views
You do not need to change your code. Just use the -fno-builtin-cos_sin option.
0 Kudos
pivo12
Beginner
854 Views

Now its works fine.

Thank you.

0 Kudos
Reply