[Patches] [ python-Patches-1116722 ] Solaris 10 fails to compile complexobject.c [FIX incl.]

SourceForge.net noreply at sourceforge.net
Thu Feb 10 04:23:01 CET 2005


Patches item #1116722, was opened at 2005-02-05 08:02
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1116722&group_id=5470

Category: Build
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Case Van Horsen (casevh)
Assigned to: Martin v. Löwis (loewis)
Summary: Solaris 10 fails to compile complexobject.c [FIX incl.]

Initial Comment:
This is a duplicate of 970334.

The fix I used was to make the following change in
pyport.h:

Change
#define Py_HUGE_VAL HUGE_VAL

to

#define PY_HUGE_VAL DBL_MAX.

DBL_MAX is found in float.h

Versions used:

Python 2.4
gcc 3.4.3
Solaris 10 x86 GA release.

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

>Comment By: Martin v. Löwis (loewis)
Date: 2005-02-10 04:23

Message:
Logged In: YES 
user_id=21627

I have the Solaris 10 iso/math_c99.h in front of me, but no
gcc, so it is somewhat difficult to get through the ifdefery.

It appears that we should have _XOPEN_SOURCE - 0 >= 600, so
we should be using

#define HUGE_VAL        __builtin_huge_val

The problem apparently is that in Sun CC, __builtin_huge_val
appears to be a constant, whereas in gcc, it probably is a
function, so the definition should read

#define HUGE_VAL __builtin_huge_val()

So there is a bug in the gcc port of Solaris here -
fixincludes should adjust the definition of HUGE_VAL when
installing its adjusted copy of math_c99.h.

I'm willing to accept patches to work around this gcc bug,
but only if the bug gets reported to gcc first. So, please,

1. find out the gcc installation directory on your system,
using gcc --print-search-dirs
2a. check whether <install>/include/iso/math_c99.h exists
2b. if it does not exist, copy if from
/usr/include/iso/math_c99.h
3. edit <install>/include/iso/math_c99.h to add the
parentheses after builtin_huge_val
4. check whether this fixes the problem
5a. if not, provide the preprocessor output for
complexobject.i, using --save-temps
5b. if it does, make a bug report to gcc, indicating that
the program

#include <math.h>
int main()
{
  double f=HUGE_VAL;
}

fails on Solaris 10. For that report
- check whether it actually fails without the update
math_c99, and succeeds with it (you might have to #define
_XOPEN_SOURCE to make it fail)
- include the preprocessor output for this sample program,
using the original math_c99
- indicate that a solution is to add parentheses

6. Come up with a patch that checks for Solaris 10 and all
gcc versions showing the problem (i.e. 3.4.x, with x<=3,
perhaps also 3.y, y<=3), and defines Py_HUGE_VAL correctly
for this system.

7. Report the gcc bug number and the patch in this report.


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

Comment By: Tim Peters (tim_one)
Date: 2005-02-10 02:43

Message:
Logged In: YES 
user_id=31435

The C standard requires that "The macro HUGE_VAL expands 
to a positive double constant expression, not necessarily 
representable as a float".  Python requires that too.  
#define'ing to worm around a broken compilation environment 
isn't acceptable to me; finding a switch to make this 
environment conform to the standard would be OK.

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

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


More information about the Patches mailing list