*BSD News Article 9335


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA5590 ; Fri, 01 Jan 93 01:50:07 EST
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!paladin.american.edu!howland.reston.ans.net!hsdndev!newsfeed.rice.edu!rice!news.Rice.edu!rich
From: rich@Rice.edu (& Murphey)
Newsgroups: comp.unix.bsd
Subject: Re: [386bsd] gcc 2.3.2 compile problems
Message-ID: <RICH.92Dec27171213@superego.Rice.edu>
Date: 27 Dec 92 23:12:13 GMT
References: <dhess.724812183@Xenon.Stanford.EDU> <BLYMN.92Dec27161320@siren.awadi.com.au>
Sender: news@rice.edu (News)
Reply-To: Rich@rice.edu
Organization: Department of Electrical and Computer Engineering, Rice
	University
Lines: 77
In-Reply-To: blymn@awadi.com.au's message of 27 Dec 92 16:13:19

>>>>> In article <BLYMN.92Dec27161320@siren.awadi.com.au>, blymn@awadi.com.au (Brett Lymn) writes:
>>>>> On 20 Dec 92 00:43:03 GMT, dhess@Xenon.Stanford.EDU (Drew William Hess) said:
D> I'm having problems getting gcc 2.3.2 to compile under 386bsd.  It's choking
D> on enquire.c, line 2303, and complaining about a floating point constant
D> being out of range.  Can someone please post or email me a fix?  Thanks.

Brett> I would not worry about it too much, if you have a look at the
Brett> comments in the .h file enquire generates you will see that the errors
Brett> that it has detected are rather infesteminal (ie the order of 1e-308)
Brett> so I suspect the rounding is wrong rather than anything else more
Brett> serious.

Brett> Apart from that gcc 2.3.2 works fine, I have compiled X with it with
Brett> only one problem, in /usr/include stdlib.h there is the following
Brett> ifdef:

Brett> #if defined(alloca) && (alloca == __builtin_alloca)
Brett> void  *alloca __P((int));     /* built-in for gcc */
Brett> #else
Brett> void    *alloca __P((size_t));
Brett> #endif /* __GNUC__ */

Brett> You have to comment out the definition of alloca like this:

Brett> #if defined(alloca) && (alloca == __builtin_alloca)
Brett> /* void  *alloca __P((int));     /* built-in for gcc */
Brett> #else
Brett> void    *alloca __P((size_t));
Brett> #endif /* __GNUC__ */

You've patched your stdlib.h with the patch supplied with XFree86 1.1.
More on that below.

Brett> Otherwise gcc gets confused and will not use the builtin alloca.
Brett> Apart from this X compiles without a hitch and it seems (to me at
Brett> least) a bit faster (not much) and a little bit smaller (again not
Brett> much).  I have not found any problems with commenting out the alloca
Brett> definition but I am not happy about doing it, anyone got a better
Brett> suggestion?

Yep, The XFree86 core team has looked at this.

libc and gcc 2.x use 'alloca(size_t)' arg while gcc 1.x uses 'alloca(int)'.
This breaks the stdlib.h patch we had included with the last XFree86
release, so I've proposed we distribute the patch below with the next
XFree86.

The new patch uses 'alloca(int)' only gcc 1.x is used and alloca is
defined as __builtin_alloca.  

Any comments are welcome either here, to XFree86 core team
<xfree86@physics.su.oz.au> or myself.  Rich@rice.edu


*** stdlib.h.dist	Mon Jul 13 08:24:09 1992
--- stdlib.h	Wed Dec 23 08:44:55 1992
***************
*** 102,108 ****
  #endif /* not ANSI */
  
  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
! void	*alloca __P((size_t));	/* built-in for gcc */
  extern	 char *optarg;			/* getopt(3) external variables */
  extern	 int optind;
  extern	 int opterr;
--- 102,112 ----
  #endif /* not ANSI */
  
  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
! #if defined(alloca) && (alloca == __builtin_alloca) && defined(__GNUC__) && (__GNUC__ < 2)
! void	*alloca __P((int));	/* built-in for gcc */
! #else
! void	*alloca __P((size_t));
! #endif /* __GNUC__ */
  extern	 char *optarg;			/* getopt(3) external variables */
  extern	 int optind;
  extern	 int opterr;