[Python-bugs-list] [ python-Bugs-595545 ] gcc warning about __builtin_fabsf

noreply@sourceforge.net noreply@sourceforge.net
Thu, 15 Aug 2002 10:24:02 -0700


Bugs item #595545, was opened at 2002-08-15 16:49
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=595545&group_id=5470

Category: Extension Modules
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Martin v. Löwis (loewis)
Summary: gcc warning about __builtin_fabsf

Initial Comment:
While compiling a third-party extension (see readyexec.sf.net), I 
got this output running setup.py:

gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC 
-I/usr/local/include/python2.3 -c fdpass.c -o 
build/temp.linux-i686-2.3/fdpass.o -Wall -Wpointer-arith 
-Wcast-qual -Wcast-align -Wconversion -Waggregate-return 
-Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Wnested-externs
In file included from /usr/include/math.h:350,
                 from /usr/local/include/python2.3/pyport.h:92,
                 from /usr/local/include/python2.3/Python.h:48,
                 from fdpass.c:11:
/usr/include/bits/mathinline.h: In function `fabsf':
/usr/include/bits/mathinline.h:446: warning: passing arg 1 of 
`__builtin_fabsf' as `float' rather than `double' due to prototype
gcc -shared build/temp.linux-i686-2.3/fdpass.o -o 
build/lib.linux-i686-2.3/fdpass.so

The extension wasn't using fabs, though I notice the addition of 
-Wstrict-prototypes to the gcc command, so maybe this is a "not 
to worry" sort of thing.

Relevant (I think) information about the system is:

    glibc 2.2.4 (the source of /usr/include/bits/mathinline.h)
    gcc 2.96

The chunk of code in mathinline.h involving __builtin_fabsf is

#if __GNUC_PREREQ (2, 8)
__inline_mathcodeNP_ (double, fabs, __x, return __builtin_fabs 
(__x))
__inline_mathcodeNP_ (float, fabsf, __x, return __builtin_fabsf 
(__x))
__inline_mathcodeNP_ (long double, fabsl, __x, return 
__builtin_fabsl (__x))
__inline_mathcodeNP_ (long double, __fabsl, __x, return 
__builtin_fabsl (__x))
#else
__inline_mathop (fabs, "fabs")
__inline_mathop_ (long double, __fabsl, "fabs")
#endif


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2002-08-15 19:24

Message:
Logged In: YES 
user_id=21627

This problem is caused by -Wconversion; the compiler warns
that it will call __builtin_fabsf with a float argument -
even though C would default to double in absence of prototypes.

The prototype for __builtin_fabsf is built into gcc. The
call to __builtin_fabsf originates from the inline function
fabsf defined by the inline_mathcode macro.

This warning occurs every time you include math.h, and
compile with both -O and -Wconversions. You may want to
report this as a glibc bug, for not supressing the warning.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2002-08-15 17:52

Message:
Logged In: YES 
user_id=31435

Maybe Martin has a clue. so assigned to him.  Line 92 of 
pyport.h is simply

#include <math.h>

There's not enough info here to guess what line 446 of 
mathinline.h may be, but it's not in Python code regardless.  
Note that Python never calls fabsf either.

Offhand it looks like you should file this report against gcc.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=595545&group_id=5470