Bug 24688 - [3.4 Regression] sco_math fixincl breaks math.h
[3.4 Regression] sco_math fixincl breaks math.h
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: bootstrap
3.4.3
: P3 normal
: 3.4.5
Assigned To: Not yet assigned to anyone
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-06 00:23 UTC by The Written Word
Modified: 2005-11-08 22:29 UTC (History)
2 users (show)

See Also:
Host: ia64-hp-hpux11.23
Target: ia64-hp-hpux11.23
Build: ia64-hp-hpux11.23
Known to work:
Known to fail:
Last reconfirmed: 2005-11-07 18:26:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description The Written Word 2005-11-06 00:23:07 UTC
I'm trying to bootstrap gcc-3.4.3 on HP-UX 11.23/IA-64. I'm bootstrapping with the HP C compiler. The system has patch PHSS_33351 installed. The tail of /usr/include/math.h:
   inline int sqr(int __x) {return(__x*__x);}
   inline double sqr(double __x) {return(__x*__x);}
#  ifndef _STDLIB_INCLUDED
     inline int abs(int __d) { return (__d>0)?__d:-__d; }
#  endif /* _STDLIB_INCLUDED */
   inline double abs(double __d) { return fabs(__d); }
   inline double pow(double __d,int __expon) { return pow(__d,(double)__expon); }
#endif

#endif /* _MATH_INCLUDED */

The tail of math.h after fixinc:
   inline double sqr(double __x) {return(__x*__x);}
#  ifndef _STDLIB_INCLUDED
     inline int abs(int __d) { return (__d>0)?__d:-__d; }
#  endif /* _STDLIB_INCLUDED */
#ifndef __GNUC__
   inline double abs(double __d) { return fabs(__d); }
   inline double pow(double __d,int __expon) { return pow(__d,(double)__expon); }
#endif

#endif /* _MATH_INCLUDED */

Looking at inclhack.def, sco_math seems to be the cause of this. I replaced 'inline double abs' in select of sco_math with 'inline double _abs' and the #ifndef __GNUC__ wasn't included in the new math.h.
Comment 1 Andrew Pinski 2005-11-06 00:24:39 UTC
I thought this was fixed in 3.4.4.
Comment 2 The Written Word 2005-11-06 00:45:01 UTC
I'm using the version of inclhack.def from gcc-3_4-branch. I looked at the changes in http://gcc.gnu.org/viewcvs/branches/gcc-3_4-branch/gcc/fixinc/inclhack.def?rev=100333&view=log and don't see anything relating to this.

Looking at the latest inclhack.def from gcc-3_4-branch, this sed line in sco_math is causing the problem:
    sed      = "/extern \"C\\+\\+\"/N;"
	       "/inline double abs/i\\\n"
               "#ifndef __GNUC__\n";

I have no idea what math.h looks like on SCO so I have no idea how to fix. Why don't we restrict sco_math to some mach="*sco*"?
Comment 3 Steve Ellcey 2005-11-07 18:26:51 UTC
It looks like this is fixed on the mainline and on the 4.0 branch by the addition of

bypass   = "__GNUG__";

This patch was done in revision 90550 by jsm28.  We should do this for the 3.4 branch as well.
Comment 4 Steve Ellcey 2005-11-07 18:40:20 UTC
Original patch submittal is at

http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00985.html

I will apply this to the 3.4 branch and test it.
Comment 5 Steve Ellcey 2005-11-08 22:29:29 UTC
I forgot to include the PR number in the ChangeLog, the fix has been checked in on the 3.4 branch for 3.4.5.  It was already fixed on the 4.0 branch and on the main line.  The patch was submitted with:

http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00474.html