From 089d89e4a28e2b1b19c67114fea1fd810a3ccd5b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 17 Mar 2017 01:37:34 -0700 Subject: [PATCH] flexmember: try to detect HP-UX 11.31 cc bug Problem reported by Bruno Haible in: http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00066.html * m4/flexmember.m4 (AC_C_FLEXIBLE_ARRAY_MEMBER): Attempt to detect bug in HP-UX 11.31 cc. --- ChangeLog | 8 ++++++++ m4/flexmember.m4 | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1843733..34606a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2017-03-17 Paul Eggert + + flexmember: try to detect HP-UX 11.31 cc bug + Problem reported by Bruno Haible in: + http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00066.html + * m4/flexmember.m4 (AC_C_FLEXIBLE_ARRAY_MEMBER): + Attempt to detect bug in HP-UX 11.31 cc. + 2017-03-16 Bruno Haible stdint: Fix test compilation failure with HP-UX 11 cc. diff --git a/m4/flexmember.m4 b/m4/flexmember.m4 index 35580ac..9d3b50d 100644 --- a/m4/flexmember.m4 +++ b/m4/flexmember.m4 @@ -1,4 +1,4 @@ -# serial 4 +# serial 5 # Check for flexible array member support. # Copyright (C) 2006, 2009-2017 Free Software Foundation, Inc. @@ -17,12 +17,15 @@ AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER], [[#include #include #include - struct s { int n; double d[]; };]], + struct m { struct m *next, **list; char name[]; }; + struct s { struct s *p; struct m *m; int n; double d[]; };]], [[int m = getchar (); size_t nbytes = offsetof (struct s, d) + m * sizeof (double); nbytes += sizeof (struct s) - 1; nbytes -= nbytes % sizeof (struct s); struct s *p = malloc (nbytes); + p->p = p; + p->m = NULL; p->d[0] = 0.0; return p->d != (double *) NULL;]])], [ac_cv_c_flexmember=yes], -- 2.7.4