*BSD News Article 9643


Return to BSD News archive

Received: by minnie.vk1xwt.ampr.org with NNTP
	id AA6172 ; Tue, 05 Jan 93 15:15:56 EST
Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!wupost!newsfeed.rice.edu!rice!news.Rice.edu!rich
From: rich@Rice.edu (& Murphey)
Subject: Re: [386bsd] gcc 2.3.2 compile problems
In-Reply-To: blymn@awadi.com.au's message of 28 Dec 92 18:26:37
Message-ID: <RICH.93Jan6215050@superego.Rice.edu>
Sender: news@rice.edu (News)
Reply-To: Rich@rice.edu
Organization: Department of Electrical and Computer Engineering, Rice
	University
References: <dhess.724812183@Xenon.Stanford.EDU> <BLYMN.92Dec27161320@siren.awadi.com.au>
	<BLYMN.92Dec28182637@siren.awadi.com.au>
Date: Thu, 7 Jan 1993 03:50:50 GMT
Lines: 77

>>>>> In article <BLYMN.92Dec28182637@siren.awadi.com.au>, blymn@awadi.com.au (Brett Lymn) writes:
Brett> NNTP-Posting-Host: siren.awadi.com.au

>>>>> On 27 Dec 92 16:13:19, blymn@awadi.com.au (Brett Lymn) said:
Brett> NNTP-Posting-Host: siren.awadi.com.au

>>>>> 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> Thanks to L. Jonas Olsson for suggesting:

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

Brett> Which will ifdef out the alloca definition for gcc 2.x but not the gcc
Brett> 1.39 (needed for the kernel rebuilds by the unadventurous ;-)

Brett> --
Brett> Brett Lymn

Bruce Evans and I discussed the alloca patch at length and after going
back and forth on various forms such as that above settled on the
following:

diff -c stdlib.h.dist stdlib.h
*** stdlib.h.dist	Mon Jul 13 08:24:09 1992
--- stdlib.h	Thu Dec 31 14:05:51 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,110 ----
  #endif /* not ANSI */
  
  #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
! #ifndef alloca
! void	*alloca __P((size_t));
! #endif
  extern	 char *optarg;			/* getopt(3) external variables */
  extern	 int optind;
  extern	 int opterr;


This works around the inconsistency between alloca declarations in
stdlib.h and that internal to gcc 1.39.  It's also what has been
proposed for inclusion in the next XFree86 release.

The declaration needs to be avoided only when using gcc 1.39 and one
has '#define alloca __builtin_alloca'.  This is because the gcc 1.39's
internal declaration is 'void __builtin_alloca(int)'.

gcc 2.x's declaration is 'void __builtin_alloca(size_t)', so the
declaration is OK whether you have #defined alloca or not.  Both
versions of gcc provide the declaration internally.  Rich