PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Compiler warnings when using math.h

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
mmartin



Joined: 11 May 2006
Posts: 4

PostPosted: Tue May 23, 2006 12:06 am    Post subject: Compiler warnings when using math.h Reply with quote

I'm trying to figure out why pgcc gives the following warnings when compiling any code I write that includes math.h:

PGC-W-0266-Null argument to macro (/usr/include/bits/mathcalls.h: 55)
PGC-W-0266-Null argument to macro (/usr/include/bits/mathcalls.h: 55)
PGC-W-0266-Null argument to macro (/usr/include/bits/mathcalls.h: 55)
PGC-W-0266-Null argument to macro (/usr/include/bits/mathcalls.h: 57)
PGC-W-0266-Null argument to macro (/usr/include/bits/mathcalls.h: 57)
PGC-W-0266-Null argument to macro (/usr/include/bits/mathcalls.h: 57)

This is only a sample of the warnings, the total number of warnings amount to hundreds of lines of the same warning with a different line number for mathcalls.h. After some digging, I've found that mathcalls.h is used in the math.h file and holds the definitions of the math functions. The line numbers in the warnings correspond to each of the definitions of the math functions. This warning only occurs when the when i use the -Xa switch when i compile. I was originally trying to find out why this warning was occurring in a large program I've begun working on, but based on those warnings, the warning is independent of any code in that program, so I copied a program from the user manual for the PGI compilers, from the section where it discusses using builtin math functions in c/c++. I used this test program to confirm that the warnings had nothing to do with the code of the other program, since the exact same warnings occur when I compile the test program using the ansi switch, -Xa (all I have to do to get the warnings is #include<math.h>).

The large program I was working on is written in ANSI C89, which is why the -Xa is needed when we compile it with pgcc. It compiles and runs correctly with various other compilers including gcc and MS Visual Studio (using the required switches for those compilers).

The machine I am compiling on is running Centos 4.3, a clone of RedHat Enterprise 4.

Any ideas why am I getting these warnings and how do I correct them?
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6134
Location: The Portland Group Inc.

PostPosted: Wed May 24, 2006 1:32 pm    Post subject: Reply with quote

Hi mmartin,

The warning occurs because in the Linux system header file bits/mathcalls.h there are several marcos which are are missing an argument. For example:
Code:
__MATHCALL (acos,, (_Mdouble_ __x));

In ANSI C89, this behaviour is undefined, hence the preprocessor issues a warning. C99 clarified this issue and allows empty macro arguments. Unfortunately, you will need to either disable warnings, "-w", or ignore the errors.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group