GNU bug report logs - #6170
24.0.50; Compiling on solaris2.10 with gcc doesn't define alloca

Previous Next

Package: emacs;

Reported by: Lawrence Mitchell <wence <at> gmx.li>

Date: Tue, 11 May 2010 11:01:01 UTC

Severity: normal

Found in version 24.0.50

Done: Dan Nicolaescu <dann <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6170 in the body.
You can then email your comments to 6170 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6170; Package emacs. (Tue, 11 May 2010 11:01:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lawrence Mitchell <wence <at> gmx.li>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 11 May 2010 11:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lawrence Mitchell <wence <at> gmx.li>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Compiling on solaris2.10 with gcc doesn't define alloca
Date: Tue, 11 May 2010 11:57:17 +0100
On this system, <stdlib.h> is provided by Sun and therefore
doesn't define alloca, unlike on a typical GNU/linux system where
<stdlib.h> contains the following:

| #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
| # include <alloca.h>
| #endif /* Use GNU, BSD, or misc.  */

When compiling emacs with gcc, alloca is therefore undefined.
The culprit is this snippet in configure.in:

| #ifndef __GNUC__
| # ifdef HAVE_ALLOCA_H
| #  include <alloca.h>
| # else /* AIX files deal with #pragma.  */
| #  ifndef alloca /* predefined by HP cc +Olibcalls */
| char *alloca ();
| #  endif
| # endif /* HAVE_ALLOCA_H */
| #endif /* __GNUC__ */

On this system, configure correctly defines both HAVE_ALLOCA_H
and HAVE_ALLOCA, but since the inclusion is guarded by __GNUC__
not being defined, we never include <alloca.h>.

I think the correct fix is to unconditionally define alloca if
__GNUC__ is detected, see patch below.  Note that this is closer
to how autoconf checks for the presence of the alloca function.

Possible changelog entry:

2010-05-11  Lawrence Mitchell  <wence <at> gmx.li>

	* configure.in: Unconditionally define alloca if __GNUC__ is
	detected.

diff --git a/configure.in b/configure.in
index 8a7d9be..98b6abb 100644
--- a/configure.in
+++ b/configure.in
@@ -3360,6 +3360,9 @@ extern char *getenv ();
 char *alloca ();
 #  endif
 # endif /* HAVE_ALLOCA_H */
+#else
+# undef alloca
+# define alloca __builtin_alloca
 #endif /* __GNUC__ */
 #ifndef HAVE_SIZE_T
 typedef unsigned size_t;




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6170; Package emacs. (Wed, 12 May 2010 18:30:03 GMT) Full text and rfc822 format available.

Message #8 received at 6170 <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> gnu.org>
To: Lawrence Mitchell <wence <at> gmx.li>
Cc: 6170 <at> debbugs.gnu.org
Subject: Re: bug#6170: 24.0.50;
	Compiling on solaris2.10 with gcc doesn't define alloca
Date: Wed, 12 May 2010 14:29:40 -0400
Lawrence Mitchell <wence <at> gmx.li> writes:

> On this system, <stdlib.h> is provided by Sun and therefore
> doesn't define alloca, unlike on a typical GNU/linux system where
> <stdlib.h> contains the following:
>
> | #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
> | # include <alloca.h>
> | #endif /* Use GNU, BSD, or misc.  */
>
> When compiling emacs with gcc, alloca is therefore undefined.
> The culprit is this snippet in configure.in:
>
> | #ifndef __GNUC__
> | # ifdef HAVE_ALLOCA_H
> | #  include <alloca.h>
> | # else /* AIX files deal with #pragma.  */
> | #  ifndef alloca /* predefined by HP cc +Olibcalls */
> | char *alloca ();
> | #  endif
> | # endif /* HAVE_ALLOCA_H */
> | #endif /* __GNUC__ */
>

"info autoconf" says that this is the proper way to do it:

          #ifdef HAVE_ALLOCA_H
          # include <alloca.h>
          #elif defined __GNUC__
          # define alloca __builtin_alloca
          #elif defined _AIX
          # define alloca __alloca
          #elif defined _MSC_VER
          # include <malloc.h>
          # define alloca _alloca
          #else
          # include <stddef.h>
          # ifdef  __cplusplus
          extern "C"
          # endif
          void *alloca (size_t);
          #endif

Not sure we need the last #else part, or the _MSC_VER part...




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6170; Package emacs. (Mon, 31 May 2010 16:46:02 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lawrence Mitchell <wence <at> gmx.li>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#6170: 24.0.50;
	Compiling on solaris2.10 with gcc doesn't define alloca
Date: Mon, 31 May 2010 17:42:34 +0100
Dan Nicolaescu wrote:
> Lawrence Mitchell <wence <at> gmx.li> writes:

>> On this system, <stdlib.h> is provided by Sun and therefore
>> doesn't define alloca, unlike on a typical GNU/linux system where
>> <stdlib.h> contains the following:

>> | #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
>> | # include <alloca.h>
>> | #endif /* Use GNU, BSD, or misc.  */

>> When compiling emacs with gcc, alloca is therefore undefined.
>> The culprit is this snippet in configure.in:

>> | #ifndef __GNUC__
>> | # ifdef HAVE_ALLOCA_H
>> | #  include <alloca.h>
>> | # else /* AIX files deal with #pragma.  */
>> | #  ifndef alloca /* predefined by HP cc +Olibcalls */
>> | char *alloca ();
>> | #  endif
>> | # endif /* HAVE_ALLOCA_H */
>> | #endif /* __GNUC__ */


> "info autoconf" says that this is the proper way to do it:

>           #ifdef HAVE_ALLOCA_H
>           # include <alloca.h>
>           #elif defined __GNUC__
>           # define alloca __builtin_alloca
>           #elif defined _AIX
>           # define alloca __alloca
>           #elif defined _MSC_VER
>           # include <malloc.h>
>           # define alloca _alloca
>           #else
>           # include <stddef.h>
>           # ifdef  __cplusplus
>           extern "C"
>           # endif
>           void *alloca (size_t);
>           #endif

> Not sure we need the last #else part, or the _MSC_VER part...

Is there any movement on getting this fix, or something like it,
installed?  It doesn't seem like a controversial change.

Cheers,
Lawrence

-- 
Lawrence Mitchell <wence <at> gmx.li>





Reply sent to Dan Nicolaescu <dann <at> gnu.org>:
You have taken responsibility. (Wed, 02 Jun 2010 09:25:02 GMT) Full text and rfc822 format available.

Notification sent to Lawrence Mitchell <wence <at> gmx.li>:
bug acknowledged by developer. (Wed, 02 Jun 2010 09:25:02 GMT) Full text and rfc822 format available.

Message #16 received at 6170-done <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> gnu.org>
To: Lawrence Mitchell <wence <at> gmx.li>
Cc: 6170-done <at> debbugs.gnu.org
Subject: Re: bug#6170: 24.0.50;
	Compiling on solaris2.10 with gcc doesn't define alloca
Date: Wed, 02 Jun 2010 05:24:36 -0400
Lawrence Mitchell <wence <at> gmx.li> writes:

> Dan Nicolaescu wrote:
>> Lawrence Mitchell <wence <at> gmx.li> writes:
>
>>> On this system, <stdlib.h> is provided by Sun and therefore
>>> doesn't define alloca, unlike on a typical GNU/linux system where
>>> <stdlib.h> contains the following:
>
>>> | #if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
>>> | # include <alloca.h>
>>> | #endif /* Use GNU, BSD, or misc.  */
>
>>> When compiling emacs with gcc, alloca is therefore undefined.
>>> The culprit is this snippet in configure.in:
>
>>> | #ifndef __GNUC__
>>> | # ifdef HAVE_ALLOCA_H
>>> | #  include <alloca.h>
>>> | # else /* AIX files deal with #pragma.  */
>>> | #  ifndef alloca /* predefined by HP cc +Olibcalls */
>>> | char *alloca ();
>>> | #  endif
>>> | # endif /* HAVE_ALLOCA_H */
>>> | #endif /* __GNUC__ */
>
>
>> "info autoconf" says that this is the proper way to do it:
>
>>           #ifdef HAVE_ALLOCA_H
>>           # include <alloca.h>
>>           #elif defined __GNUC__
>>           # define alloca __builtin_alloca
>>           #elif defined _AIX
>>           # define alloca __alloca
>>           #elif defined _MSC_VER
>>           # include <malloc.h>
>>           # define alloca _alloca
>>           #else
>>           # include <stddef.h>
>>           # ifdef  __cplusplus
>>           extern "C"
>>           # endif
>>           void *alloca (size_t);
>>           #endif
>
>> Not sure we need the last #else part, or the _MSC_VER part...
>
> Is there any movement on getting this fix, or something like it,
> installed?  It doesn't seem like a controversial change.

Should be fixed now.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Jun 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 362 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.