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

/Wp64 is not flagging any error for .cpp files.

abhijeet_thatte
Beginner
442 Views
Hi,

I wrote a small snippet as follows:

/******warning.c*****/
typedef struct _node {
unsigned int var_32:16;
char var_8;
}node;

int main()
{
unsigned long long y = 6;
node local_node;
local_node.var_32 = (unsigned int) (y & 0xFFFF);
return 0;
}


and compiled as icl /c /Wp64 warning.c and got an error
error #2259: non-pointer conversion from "unsigned __int64" to "unsigned int" may lose significant bits

Then I renamed the file as warning.cpp and compiled again with same option but did not get any error. Then I tried with VC2005 (cl /c /Wp64 warning.c) and still no error. Then why only ICL is giving an error. (I know the reason why I am getting it. But I wonder why others are not giving the same error.)

Thanks,
Abhi
0 Kudos
5 Replies
Om_S_Intel
Employee
442 Views
The Intel compiler should give warning with following command:

icl /c /Wp64 /Qdiag-enable:sc3 warning.cpp

In the avove testcase it is not emitting this warning. This seems bug to me.
0 Kudos
Om_S_Intel
Employee
442 Views
The Intel Compiler should givewarning using the following command line:

icl /c /Wp64 /Qdiag-enable:sc3 warning.cpp

In the current test case no warning is emmited. This seems a bug to me.

0 Kudos
abhijeet_thatte
Beginner
442 Views
Hey, I kinda of found a reason. On VC2005 64 bit compilatation,/Wp64 is depricated. So I dont get any error on VC2005 or VC2008. But I wonder why Intel has kept it for 64bit compilation. (I am refering to Intel 64bit compiler.)
0 Kudos
Om_S_Intel
Employee
442 Views

The option has not been removed yet even in VS2010. I think if you use theoption in command line it should still give error.

0 Kudos
levicki
Valued Contributor I
442 Views
That is not a very good test case.

Here is a detailed explanation how to use /Wp64 properly:
http://www.viva64.com/en/a/0021/
0 Kudos
Reply