From d9741b61c8e446de084cc4dc609aaa8e5702118d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 20 Sep 2016 08:30:17 -0700 Subject: Use flexmembers on IBM XL C for AIX This removes a workaround where Emacs did not use flexible array members when compiled with IBM XL C. Instead, avoid the problem by making the aliasing issues more obvious to this compiler. * admin/merge-gnulib: Don’t remove m4/flexmember.m4. * m4/flexmember.m4: Copy from gnulib. * configure.ac (AC_C_FLEXIBLE_ARRAY_MEMBER): Remove workaround. * src/alloc.c (allocate_string_data): Rephrase to avoid aliasing problem that would otherwise mess up code generated for flexible array members by IBM XL C for AIX, V12.1. * src/conf_post.h (FLEXIBLE_ARRAY_MEMBER): Remove; now done by gnulib code. --- src/alloc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 1092a34801a..41b2f9e77d2 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2002,9 +2002,9 @@ allocate_string_data (struct Lisp_String *s, mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); #endif - b->next_free = b->data; - b->data[0].string = NULL; + data = b->data; b->next = large_sblocks; + b->next_free = data; large_sblocks = b; } else if (current_sblock == NULL @@ -2014,9 +2014,9 @@ allocate_string_data (struct Lisp_String *s, { /* Not enough room in the current sblock. */ b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP); - b->next_free = b->data; - b->data[0].string = NULL; + data = b->data; b->next = NULL; + b->next_free = data; if (current_sblock) current_sblock->next = b; @@ -2025,14 +2025,16 @@ allocate_string_data (struct Lisp_String *s, current_sblock = b; } else - b = current_sblock; + { + b = current_sblock; + data = b->next_free; + } - data = b->next_free; + data->string = s; b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA); MALLOC_UNBLOCK_INPUT; - data->string = s; s->data = SDATA_DATA (data); #ifdef GC_CHECK_STRING_BYTES SDATA_NBYTES (data) = nbytes; -- cgit v1.2.1