GNU bug report logs - #18368
HYBRID_MALLOC broke AIX build

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sat, 30 Aug 2014 22:52:01 UTC

Severity: normal

Fixed in version 25.1

Done: Ken Brown <kbrown <at> cornell.edu>

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 18368 in the body.
You can then email your comments to 18368 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 bug-gnu-emacs <at> gnu.org:
bug#18368; Package emacs. (Sat, 30 Aug 2014 22:52:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 30 Aug 2014 22:52:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Emacs bug reports and feature requests <bug-gnu-emacs <at> gnu.org>
Cc: Ken Brown <kbrown <at> cornell.edu>
Subject: HYBRID_MALLOC broke AIX build
Date: Sat, 30 Aug 2014 15:50:30 -0700
The trunk's recent HYBRID_MALLOC changes broke the build on AIX.  Here 
are the first couple of compile-time diagnostics:

xlc -c  -Demacs  -I. -I. -I../lib -I../lib -g3 -O  gmalloc.c
"/usr/include/unistd.h", line 201.17: 1506-343 (S) Redeclaration of 
lseek64 differs from previous declaration on line 199 of 
"/usr/include/unistd.h".
"/usr/include/unistd.h", line 201.17: 1506-050 (I) Return type "long 
long" in redeclaration is not compatible with the previous return type 
"long".

The culprit is this part of gmalloc.c:

/* If HYBRID_MALLOC is defined in config.h, then conf_post.h #defines
   malloc and friends as macros before including stdlib.h.  In this
   file we will need the prototypes for the system malloc, so we must
   include stdlib.h before config.h.  And we have to do this
   unconditionally, since HYBRID_MALLOC hasn't been defined yet.  */
#include <stdlib.h>

#include <config.h>


This doesn't work, as <config.h> must come first for various reasons; I 
suspect the AIX breakage is just the tip of the iceberg.

One possible fix is to declare the system malloc directly, if 
HYBRID_MALLOC is defined.  Another one, which might be safer, is to 
modify config.h to capture the system malloc before it's redefined.

Since AIX does not define HYBRID_MALLOC, I have temporarily worked 
around the problem on my AIX host by using this in gmalloc.c:

#ifdef HYBRID_MALLOC
#include <stdlib.h>
#endif

#include <config.h>

#include <stdlib.h>

but I suspect this is not the right way to fix the problems on platforms 
that need HYBRID_MALLOC but have AIX-like problems with redefinitions.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18368; Package emacs. (Sun, 31 Aug 2014 01:43:02 GMT) Full text and rfc822 format available.

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

From: Ken Brown <kbrown <at> cornell.edu>
To: Paul Eggert <eggert <at> cs.ucla.edu>, 18368 <at> debbugs.gnu.org
Subject: Re: bug#18368: HYBRID_MALLOC broke AIX build
Date: Sat, 30 Aug 2014 21:41:57 -0400
On 8/30/2014 6:50 PM, Paul Eggert wrote:
> The trunk's recent HYBRID_MALLOC changes broke the build on AIX.

How's this:

=== modified file 'src/gmalloc.c'
--- src/gmalloc.c       2014-08-28 14:48:02 +0000
+++ src/gmalloc.c       2014-08-31 01:29:41 +0000
@@ -19,13 +19,6 @@
    The author may be reached (Email) at the address mike <at> ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */

-/* If HYBRID_MALLOC is defined in config.h, then conf_post.h #defines
-   malloc and friends as macros before including stdlib.h.  In this
-   file we will need the prototypes for the system malloc, so we must
-   include stdlib.h before config.h.  And we have to do this
-   unconditionally, since HYBRID_MALLOC hasn't been defined yet.  */
-#include <stdlib.h>
-
 #include <config.h>

 #if defined HAVE_PTHREAD && !defined HYBRID_MALLOC
@@ -1725,6 +1718,17 @@
 #undef aligned_alloc
 #undef free

+/* Declare system malloc and friends.  */
+extern void *malloc (size_t size);
+extern void *realloc (void *ptr, size_t size);
+extern void *calloc (size_t nmemb, size_t size);
+extern void free (void *ptr);
+#ifdef HAVE_ALIGNED_ALLOC
+extern void *aligned_alloc (size_t alignment, size_t size);
+#elif defined HAVE_POSIX_MEMALIGN
+extern int posix_memalign (void **memptr, size_t alignment, size_t size);
+#endif
+
 /* See the comments near the beginning of this file for explanations
    of the following functions. */






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18368; Package emacs. (Sun, 31 Aug 2014 02:22:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Ken Brown <kbrown <at> cornell.edu>, 18368 <at> debbugs.gnu.org
Subject: Re: bug#18368: HYBRID_MALLOC broke AIX build
Date: Sat, 30 Aug 2014 19:21:40 -0700
Ken Brown wrote:
> How's this:

Thanks, I verified that that patch works on AIX.




Reply sent to Ken Brown <kbrown <at> cornell.edu>:
You have taken responsibility. (Sun, 31 Aug 2014 02:43:02 GMT) Full text and rfc822 format available.

Notification sent to Paul Eggert <eggert <at> cs.ucla.edu>:
bug acknowledged by developer. (Sun, 31 Aug 2014 02:43:03 GMT) Full text and rfc822 format available.

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

From: Ken Brown <kbrown <at> cornell.edu>
To: Paul Eggert <eggert <at> cs.ucla.edu>, 18368-done <at> debbugs.gnu.org
Subject: Re: bug#18368: HYBRID_MALLOC broke AIX build
Date: Sat, 30 Aug 2014 22:42:21 -0400
Version: 24.5

On 8/30/2014 10:21 PM, Paul Eggert wrote:
> Thanks, I verified that that patch works on AIX.

I've installed the patch in the trunk as bzr revision 117787.

Ken




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 28 Sep 2014 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 04 Oct 2014 16:36:06 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 25.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 04 Oct 2014 16:36:06 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 24.5. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 04 Oct 2014 16:36:06 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Nov 2014 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 317 days ago.

Previous Next


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