Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.

strange error with icpc for linux

pivo12
Beginner
423 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
423 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

5 Replies
Melanie_B_Intel
Employee
423 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
pivo12
Beginner
423 Views
Thanks for the answer. But what the problem with the 'cos_sin()' function name?
Melanie_B_Intel
Employee
424 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
Judith_W_Intel
Employee
423 Views
You do not need to change your code. Just use the -fno-builtin-cos_sin option.
pivo12
Beginner
423 Views

Now its works fine.

Thank you.

Reply