* Ralf Wildenhues wrote on Wed, Aug 25, 2010 at 11:25:03PM CEST: > Continuing with M4 branch-1.4 failures on AIX 5.3: [...] > *** m4-tmp.569356/m4-xerr Wed Aug 25 19:05:46 2010 > --- m4-tmp.569356/m4-err Wed Aug 25 19:05:46 2010 > *************** > *** 0 **** > --- 1,3 ---- > + m4:stdin:1: bad regular expression: `\<[a-z]\w+': Memory exhausted
> Bisect showed that if I go back to v1.4.14, the errors persist. > > Bisect of gnulib/ subdir converges at > commit 723fc0b7b3a5d770a48945c1e1bca262a4c2615a > which is the "Use modern idiom for malloc() replacement." patch in > http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00176.html > (all errors stem from this patch). > > I see that confdefs.h before contains '#define malloc rpl_malloc' > and doesn't afterwards, but no other changes in the output section > of the respective config.log files. Assuming that the stdlib.h header > logic is correct, my next best bet would be that some source doesn't > actually get to see the replaced header, but can't find any instances > of that right now, and it's late ... malloc is broken, as is calloc. Inspection indicates realloc too. Bruno, I suggest this patch series to fix the fallout from: http://lists.gnu.org/archive/html/bug-gnulib/2010-06/msg00176.html I have confirmed that the tests expose the breakage of malloc and calloc on AIX, and the final patch fixes them. OK to commit? The patch series makes M4's own testsuite pass, but in the meantime, something else broke again so I'm still not completely done. Thanks, Ralf
>From aa2ee33baa45ebef6750fcec0d8f993af81d2e98 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues <ralf.wildenh...@gmx.de> Date: Sat, 28 Aug 2010 09:07:47 +0200 Subject: [PATCH 1/4] Tests for module 'calloc'. * modules/calloc-tests: New file. * tests/test-calloc.c: New file. --- ChangeLog | 6 ++++++ modules/calloc-tests | 11 +++++++++++ tests/test-calloc.c | 24 ++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 0 deletions(-) create mode 100644 modules/calloc-tests create mode 100644 tests/test-calloc.c diff --git a/ChangeLog b/ChangeLog index 57759fe..8d376bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-28 Ralf Wildenhues <ralf.wildenh...@gmx.de> + + Tests for module 'calloc'. + * modules/calloc-tests: New file. + * tests/test-calloc.c: New file. + 2010-08-27 Ralf Wildenhues <ralf.wildenh...@gmx.de> accept4: depend on socklen diff --git a/modules/calloc-tests b/modules/calloc-tests new file mode 100644 index 0000000..fc31e76 --- /dev/null +++ b/modules/calloc-tests @@ -0,0 +1,11 @@ +Files: +tests/test-calloc.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-calloc +check_PROGRAMS += test-calloc + diff --git a/tests/test-calloc.c b/tests/test-calloc.c new file mode 100644 index 0000000..24e1774 --- /dev/null +++ b/tests/test-calloc.c @@ -0,0 +1,24 @@ +/* Test of calloc function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> +#include <stdlib.h> + +int +main () +{ + return !calloc (0, 0) || calloc ((size_t) -1 / 8 + 1, 8); +} -- 1.7.2.1.222.g9988
>From d1439911ae9ec1decd188144f3424a747d724842 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues <ralf.wildenh...@gmx.de> Date: Sat, 28 Aug 2010 09:08:28 +0200 Subject: [PATCH 2/4] Tests for module 'malloc'. * modules/malloc-tests: New file. * tests/test-malloc.c: New file. --- ChangeLog | 4 ++++ modules/malloc-tests | 11 +++++++++++ tests/test-malloc.c | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 modules/malloc-tests create mode 100644 tests/test-malloc.c diff --git a/ChangeLog b/ChangeLog index 8d376bd..7c399b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-08-28 Ralf Wildenhues <ralf.wildenh...@gmx.de> + Tests for module 'malloc'. + * modules/malloc-tests: New file. + * tests/test-malloc.c: New file. + Tests for module 'calloc'. * modules/calloc-tests: New file. * tests/test-calloc.c: New file. diff --git a/modules/malloc-tests b/modules/malloc-tests new file mode 100644 index 0000000..6d962cf --- /dev/null +++ b/modules/malloc-tests @@ -0,0 +1,11 @@ +Files: +tests/test-malloc.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-malloc +check_PROGRAMS += test-malloc + diff --git a/tests/test-malloc.c b/tests/test-malloc.c new file mode 100644 index 0000000..4668f35 --- /dev/null +++ b/tests/test-malloc.c @@ -0,0 +1,24 @@ +/* Test of malloc function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> +#include <stdlib.h> + +int +main () +{ + return malloc(0) == NULL; +} -- 1.7.2.1.222.g9988
>From de63ff6fd3769d9644fc9153f3d2f2ea2721da48 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues <ralf.wildenh...@gmx.de> Date: Sat, 28 Aug 2010 09:09:08 +0200 Subject: [PATCH 3/4] Tests for module 'realloc'. * modules/realloc-tests: New file. * tests/test-realloc.c: New file. --- ChangeLog | 4 ++++ modules/realloc-tests | 11 +++++++++++ tests/test-realloc.c | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 0 deletions(-) create mode 100644 modules/realloc-tests create mode 100644 tests/test-realloc.c diff --git a/ChangeLog b/ChangeLog index 7c399b1..626d8cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-08-28 Ralf Wildenhues <ralf.wildenh...@gmx.de> + Tests for module 'realloc'. + * modules/realloc-tests: New file. + * tests/test-realloc.c: New file. + Tests for module 'malloc'. * modules/malloc-tests: New file. * tests/test-malloc.c: New file. diff --git a/modules/realloc-tests b/modules/realloc-tests new file mode 100644 index 0000000..63a167c --- /dev/null +++ b/modules/realloc-tests @@ -0,0 +1,11 @@ +Files: +tests/test-realloc.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-realloc +check_PROGRAMS += test-realloc + diff --git a/tests/test-realloc.c b/tests/test-realloc.c new file mode 100644 index 0000000..645e7a4 --- /dev/null +++ b/tests/test-realloc.c @@ -0,0 +1,24 @@ +/* Test of realloc function. + Copyright (C) 2010 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include <config.h> +#include <stdlib.h> + +int +main () +{ + return ! realloc (0, 0); +} -- 1.7.2.1.222.g9988
>From 54a82d1e9923255574447423c8f1c90fac8e5934 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues <ralf.wildenh...@gmx.de> Date: Sat, 28 Aug 2010 09:21:08 +0200 Subject: [PATCH 4/4] Fix malloc, calloc, and realloc modules for AIX. * lib/calloc.c [!HAVE_CALLOC]: Also define NEED_CALLOC_GNU in this case. * lib/malloc.c [!HAVE_MALLOC]: Also define NEED_MALLOC_GNU in this case. * lib/realloc.c [!HAVE_REALLOC]: Also define NEED_REALLOC_GNU in this case. Also define SYSTEM_MALLOC_GLIBC_COMPATIBLE, if also GNULIB_MALLOC_GNU. Fixes testsuite regressions of GNU M4 branch-1.4 on AIX 5.3 reported by Rainer Tammer. Regression introduced in v0.0-4009-g723fc0b. Signed-off-by: Ralf Wildenhues <ralf.wildenh...@gmx.de> --- ChangeLog | 12 ++++++++++++ lib/calloc.c | 5 +++-- lib/malloc.c | 5 +++-- lib/realloc.c | 10 ++++++---- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 626d8cf..0a6403f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2010-08-28 Ralf Wildenhues <ralf.wildenh...@gmx.de> + Fix malloc, calloc, and realloc modules for AIX. + * lib/calloc.c [!HAVE_CALLOC]: Also define NEED_CALLOC_GNU + in this case. + * lib/malloc.c [!HAVE_MALLOC]: Also define NEED_MALLOC_GNU + in this case. + * lib/realloc.c [!HAVE_REALLOC]: Also define NEED_REALLOC_GNU + in this case. Also define SYSTEM_MALLOC_GLIBC_COMPATIBLE, + if also GNULIB_MALLOC_GNU. + Fixes testsuite regressions of GNU M4 branch-1.4 on AIX 5.3 + reported by Rainer Tammer. + Regression introduced in v0.0-4009-g723fc0b. + Tests for module 'realloc'. * modules/realloc-tests: New file. * tests/test-realloc.c: New file. diff --git a/lib/calloc.c b/lib/calloc.c index d28e158..a054074 100644 --- a/lib/calloc.c +++ b/lib/calloc.c @@ -18,8 +18,9 @@ /* written by Jim Meyering and Bruno Haible */ #include <config.h> -/* Only the AC_FUNC_CALLOC macro defines 'calloc' already in config.h. */ -#ifdef calloc +/* The AC_FUNC_CALLOC macro defines 'calloc' already in config.h, + gl_FUNC_CALLOC_GNU instead defines HAVE_CALLOC to 0. */ +#if defined(calloc) || HAVE_CALLOC == 0 # define NEED_CALLOC_GNU # undef calloc #endif diff --git a/lib/malloc.c b/lib/malloc.c index f236f37..2211d96 100644 --- a/lib/malloc.c +++ b/lib/malloc.c @@ -19,8 +19,9 @@ /* written by Jim Meyering and Bruno Haible */ #include <config.h> -/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ -#ifdef malloc +/* The AC_FUNC_MALLOC macro defines 'malloc' already in config.h, + gl_FUNC_MALLOC_GNU instead defines HAVE_MALLOC to 0. */ +#if defined(malloc) || HAVE_MALLOC == 0 # define NEED_MALLOC_GNU # undef malloc #endif diff --git a/lib/realloc.c b/lib/realloc.c index 36aeecc..5665c71 100644 --- a/lib/realloc.c +++ b/lib/realloc.c @@ -20,14 +20,16 @@ #include <config.h> -/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h. */ -#ifdef realloc +/* The AC_FUNC_REALLOC macro defines 'realloc' already in config.h, + gl_FUNC_REALLOC_GNU instead defines HAVE_REALLOC to 0. */ +#if defined(realloc) || HAVE_REALLOC == 0 # define NEED_REALLOC_GNU 1 #endif /* Infer the properties of the system's malloc function. - Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */ -#if GNULIB_MALLOC_GNU && !defined malloc + The AC_FUNC_MALLOC macro defines 'malloc' already in config.h, + gl_FUNC_MALLOC_GNU instead defines HAVE_MALLOC to 0. */ +#if GNULIB_MALLOC_GNU && (!defined malloc || HAVE_MALLOC == 0) # define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1 #endif -- 1.7.2.1.222.g9988