Rainer Tammer | 11 Aug 2010 10:10

Re: next m4 snapshot [was: M4 1.4.14 on AIX 7.1BETA]

 Hello,
I have checked the snap shot on AIX 5.3 (to avoid problem with the AIX
7.1BETA):

On 09.08.2010 23:26, Eric Blake wrote:
> On 07/30/2010 08:23 AM, Eric Blake wrote:
>> Now fixed in gnulib, and therefore in my current m4 snapshot:
>>
>> Grab m4-1.4.14.6-76d1 from http://people.redhat.com/eblake/m4/
> Now at m4-1.4.14.7-19d5 from the same location.
>
>> I'm hoping that all the strtod issues have been resolved, but nothing
>> has been done on the regex issues, so that still remains something to
>> resolve.
> This should fix the strtod "0xp" problem that the last round uncovered,
> as well as including several of Bruno's cleanup patches on various
> functions.  However, it still does not do anything in particular to
> address the spurious regex memory failure.  Any help you can give, like
> single stepping through the failing re_compile_pattern, would be
> appreciated.
>

Unfortunately this did not sove the gnulib problem. The rexex related
errors
are still there.

This are the failures:

Checking ./164.regexp
 <at>  ../doc/m4.texinfo:5688: Origin of test
(Continue reading)

Jay K | 18 Aug 2010 21:27
Picon
Favicon

minor warnings compiling m4 wrt fseeko and wctype/const

Just warnings. Not errors. Result seems to work.



/home/jayk/src/m4-1.4.14/lib/regcomp.c: In function 'build_charclass':
/home/jayk/src/m4-1.4.14/lib/regcomp.c:3541:3: warning: passing argument 1 of 'wctype' discards qualifiers from pointer target type
/usr/include/wctype.h:103:20: note: expected 'char *' but argument is of type 'const char *'



gcc -std=gnu99    -I/home/jayk/src/m4-1.4.14/lib -I../lib -mieee   -g -O2 -MT debug.o -MD -MP -MF .deps/debug.Tpo -c -o debug.o /home/jayk/src/m4-1.4.14/src/debug.c
/home/jayk/src/m4-1.4.14/src/debug.c: In function 'debug_flush_files':
/home/jayk/src/m4-1.4.14/src/debug.c:194:7: warning: implicit declaration of function 'fseeko'
mv -f .deps/debug.Tpo .deps/debug.Po
gcc -std=gnu99    -I/home/jayk/src/m4-1.4.14/lib -I../lib -mieee   -g -O2 -MT eval.o -MD



mv -f .deps/input.Tpo .deps/input.Po
gcc -std=gnu99    -I/home/jayk/src/m4-1.4.14/lib -I../lib -mieee   -g -O2 -MT macro.o -MD -MP -MF .deps/macro.Tpo -c -o macro.o /home/jayk/src/m4-1.4.14/src/macro.c
mv -f .deps/macro.Tpo .deps/macro.Po
gcc -std=gnu99    -I/home/jayk/src/m4-1.4.14/lib -I../lib -mieee   -g -O2 -MT output.o -MD -MP -MF .deps/output.Tpo -c -o output.o /home/jayk/src/m4-1.4.14/src/output.c
/home/jayk/src/m4-1.4.14/src/output.c: In function 'm4_tmpopen':
/home/jayk/src/m4-1.4.14/src/output.c:254:7: warning: implicit declaration of function 'fseeko'


fseeko is in stdio.h but guarded:


#if _XOPEN_SOURCE>=500
#include <sys/types.h>
extern int    fseeko __((FILE *, off_t, int));
extern off_t    ftello __((FILE *));


bash-4.1$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/jayk/libexec/gcc/alphaev67-dec-osf5.1/4.5.0/lto-wrapper
Target: alphaev67-dec-osf5.1
Configured with: /home/jayk/src/gcc-4.5.0/configure -disable-nls -prefix=/home/jayk
Thread model: posix
gcc version 4.5.0 (GCC)


bash-4.1$ uname -a
OSF1 hostname V5.1 732 alpha alpha Tru64


 - Jay
Eric Blake | 18 Aug 2010 21:37
Picon
Favicon
Gravatar

Re: minor warnings compiling m4 wrt fseeko and wctype/const

On 08/18/2010 01:27 PM, Jay K wrote:
> 
> /home/jayk/src/m4-1.4.14/lib/regcomp.c: In function 'build_charclass':
> /home/jayk/src/m4-1.4.14/lib/regcomp.c:3541:3: warning: passing argument 1 of 'wctype' discards
qualifiers from pointer target type
> /usr/include/wctype.h:103:20: note: expected 'char *' but argument is of type 'const char *'

I'm not sure if that has been fixed in gnulib yet or not, but you can
find out by testing the recent snapshot:
http://lists.gnu.org/archive/html/bug-m4/2010-08/msg00000.html

> gcc -std=gnu99    -I/home/jayk/src/m4-1.4.14/lib -I../lib -mieee   -g -O2 -MT debug.o -MD -MP -MF
.deps/debug.Tpo -c -o debug.o /home/jayk/src/m4-1.4.14/src/debug.c
> /home/jayk/src/m4-1.4.14/src/debug.c: In function 'debug_flush_files':
> /home/jayk/src/m4-1.4.14/src/debug.c:194:7: warning: implicit declaration of function 'fseeko'
> mv -f .deps/debug.Tpo .deps/debug.Po
> gcc -std=gnu99    -I/home/jayk/src/m4-1.4.14/lib -I../lib -mieee   -g -O2 -MT eval.o -MD 

Already fixed in git.  I'd release 1.4.15 already, except that there is
a regression on AIX that I still haven't been able to figure out.

--

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Ralf Wildenhues | 21 Aug 2010 10:42
Picon
Picon

debugging M4 on AIX 5.3

I'm trying to debug the recent regression of git branch-1.4 M4 over M4
1.4.14 on AIX.  First the gnulib stuff.

Notes:

- 2 gnulib test failures in M4: test-strtod, test-rmdir.

I inserted one fprintf in test-strtod.c, for the "0xp" input asserting
over 'ptr == input + 1':

    const char input[] = "0xp";
    char *ptr;
    double result;
    errno = 0;
    result = strtod (input, &ptr);
    ASSERT (result == 0.0);
    ASSERT (!signbit (result));
    fprintf (stderr, "ptr is %lu, input + 1 is %lu\n", (unsigned long) ptr, (unsigned long) input + 1);
    ASSERT (ptr == input + 1);          /* glibc-2.3.6, MacOS X 10.3, FreeBSD 6.2, AIX 7.1 */
    ASSERT (errno == 0);

$ ./test-strtod
ptr is 804398203, input + 1 is 804398201
../../m4/tests/test-strtod.c:434: assertion failed
zsh: abort (core dumped)  ./test-strtod

I inserted one fprintf in test-rmdir.h, for the empty directory errno
test:
  ASSERT (func (BASE "dir/.//") == -1);
  fprintf (stderr, "errno = %d, %s\n", errno, strerror(errno) );
  ASSERT (errno == EINVAL || errno == EBUSY);

$ ./test-rmdir
errno = 17, File exists
../../m4/tests/test-rmdir.h:70: assertion failed
zsh: abort (core dumped)  ./test-rmdir

In 1.4.14, only the latter fails, at the same position.

- 'gnulib-tool --with-tests --test strtod rmdir' passes on this system.

- 'gnulib-tool --with-tests --dir=strtod --test announce-gen assert autobuild avltree-oset
binary-io c-stack clean-temp cloexec close-stream closein config-h dirname error execute fdl-1.3
fflush filenamecat fopen fopen-safer fseeko gendocs getopt-gnu git-version-gen gnu-web-doc-update
gnumakefile gnupload gpl-3.0 ignore-value intprops maintainer-makefile manywarnings memchr2
mkstemp obstack pipe progname regex sigaction stdbool stdint stdlib-safer strsignal strstr strtod
strtol unlocked-io update-copyright vc-list-files verror version-etc version-etc-fsf
wait-process xalloc xoset xprintf xvasprintf-posix'

passes as well.

Any hints as to what could make the tests fail when run as part of the M4
git tree and not otherwise?

CC is "cc -qlanglvl=extc89 -qlanglvl=extc99" in both cases, CFLAGS=-g.
LIBOBJS contains strtod.lo respective strtod.o, in both cases
config.status contains these lines:

S["REPLACE_STRTOD"]="1"
S["HAVE_STRTOD"]="1"
S["GNULIB_STRTOD"]="1"
D["HAVE_RAW_DECL_STRTOD"]=" 1"

but in the 'gnulib-tool --test' directories, it also contains

D["HAVE_DECL_STRTOD"]=" 1"

Autoconf on this system was a bit old, 2.62.61-550a5, if you think that
could matter I can retry after updating.

Thanks,
Ralf

Paul Eggert | 22 Aug 2010 15:47
Favicon

Re: debugging M4 on AIX 5.3

On 08/21/2010 01:42 AM, Ralf Wildenhues wrote:

> Any hints as to what could make the tests fail when run as part of the M4
> git tree and not otherwise?

I don't envy you debugging that, but I have seen similar discrepancies
for directory-style tests when my two source trees are in different file
systems; perhaps that might explain your rmdir results.  For the strtod
stuff the HAVE_DECL_STRTOD discrepancy is odd; perhaps you can look in
the logs and see why that is.

I never bother using older autoconfs, so I can't be of much help with
anything older than autoconf 2.67.  If an upgrade to that version fixes
the problem, then evidently there would be some use in gnulib that 
assumes newer autoconf.

Eric Blake | 23 Aug 2010 16:04
Picon
Favicon
Gravatar

Re: debugging M4 on AIX 5.3

On 08/21/2010 02:42 AM, Ralf Wildenhues wrote:
> I'm trying to debug the recent regression of git branch-1.4 M4 over M4
> 1.4.14 on AIX.  First the gnulib stuff.
>
> Notes:
>
> - 2 gnulib test failures in M4: test-strtod, test-rmdir.
>
> I inserted one fprintf in test-strtod.c, for the "0xp" input asserting
> over 'ptr == input + 1':

The strtod problem should already be fixed in gnulib; it's just that I 
haven't (yet) pushed the m4 patch that updates the gnulib submodule to 
the appropriate commit where it was fixed in gnulib.

> $ ./test-rmdir
> errno = 17, File exists
> ../../m4/tests/test-rmdir.h:70: assertion failed
> zsh: abort (core dumped)  ./test-rmdir
>
>
> In 1.4.14, only the latter fails, at the same position.
>
>
> - 'gnulib-tool --with-tests --test strtod rmdir' passes on this system.
>
> - 'gnulib-tool --with-tests --dir=strtod --test announce-gen assert autobuild avltree-oset
binary-io c-stack clean-temp cloexec close-stream closein config-h dirname error execute fdl-1.3
fflush filenamecat fopen fopen-safer fseeko gendocs getopt-gnu git-version-gen gnu-web-doc-update
gnumakefile gnupload gpl-3.0 ignore-value intprops maintainer-makefile manywarnings memchr2
mkstemp obstack pipe progname regex sigaction stdbool stdint stdlib-safer strsignal strstr strtod
strtol unlocked-io update-copyright vc-list-files verror version-etc version-etc-fsf
wait-process xalloc xoset xprintf xvasprintf-posix'

And that list matches the contents of m4's gnulib-cache.m4,

>
> passes as well.
>
> Any hints as to what could make the tests fail when run as part of the M4
> git tree and not otherwise?

Hmm, nothing obvious to me at the moment.  Is there an strace-like 
functionality, where we could see the actual syscalls being made during 
test-rmdir?  Unless this is another case of using an out-of-date gnulib 
submodule.

>
> Autoconf on this system was a bit old, 2.62.61-550a5, if you think that
> could matter I can retry after updating.

Don't think it should matter any, for this particular issue.

--

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Ralf Wildenhues | 25 Aug 2010 21:03
Picon
Picon

Re: debugging M4 on AIX 5.3

* Eric Blake wrote on Mon, Aug 23, 2010 at 04:04:54PM CEST:
> On 08/21/2010 02:42 AM, Ralf Wildenhues wrote:
> >- 2 gnulib test failures in M4: test-strtod, test-rmdir.
> >
> >I inserted one fprintf in test-strtod.c, for the "0xp" input asserting
> >over 'ptr == input + 1':
> 
> The strtod problem should already be fixed in gnulib; it's just that
> I haven't (yet) pushed the m4 patch that updates the gnulib
> submodule to the appropriate commit where it was fixed in gnulib.

I can confirm that after checkout out current gnulib git in the
submodule and an 'gnulib-tool --update' in M4, a fresh build does not
have the test-strtod failure any more.

> >Any hints as to what could make the tests fail when run as part of the M4
> >git tree and not otherwise?
> 
> Hmm, nothing obvious to me at the moment.  Is there an strace-like
> functionality, where we could see the actual syscalls being made
> during test-rmdir?  Unless this is another case of using an
> out-of-date gnulib submodule.

This is the output from 'truss ./test-rmdir':
[...]
rmdir("test-rmdir.tdir/file/")                  Err#20 ENOTDIR
rmdir("test-rmdir.tdir")                        Err#17 EEXIST
rmdir("test-rmdir.tdir/file")                   Err#20 ENOTDIR
unlink("test-rmdir.tdir/file")                  = 0
rmdir("test-rmdir.tdir/.//")                    Err#17 EEXIST
[...]

If I read Posix correctly, then EEXIST is not allowed for this
condition; not sure whether gnulib should work around this though.
Anyway the patch below lets the test pass.  Is it acceptable for gnulib?

And apologies for this false cue:

> >- 'gnulib-tool --with-tests --test strtod rmdir' passes on this system.

that happened because I took that from a gnulib tree with the fix below
in it, done months ago but then forgotten about it.  :-/

I've confirmed that the fix is needed for test-unlinkat as well.

Thanks,
Ralf

    Fix test-unlinkat, test-rmdir failure on AIX 5.3.

    * tests/test-rmdir.h: Also accept EEXIST for
    rmdir ("dir/.//"), unlinkat.

diff --git a/tests/test-rmdir.h b/tests/test-rmdir.h
index 6d5d56e..e9e625f 100644
--- a/tests/test-rmdir.h
+++ b/tests/test-rmdir.h
 <at>  <at>  -66,7 +66,7  <at>  <at>  test_rmdir_func (int (*func) (char const *name), bool print)
   ASSERT (unlink (BASE "dir/file") == 0);
   errno = 0;
   ASSERT (func (BASE "dir/.//") == -1);
-  ASSERT (errno == EINVAL || errno == EBUSY);
+  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST);
   ASSERT (func (BASE "dir") == 0);

   /* Test symlink behavior.  Specifying trailing slash should remove

Eric Blake | 25 Aug 2010 22:10
Picon
Favicon
Gravatar

Re: debugging M4 on AIX 5.3

On 08/25/2010 01:03 PM, Ralf Wildenhues wrote:
> This is the output from 'truss ./test-rmdir':
> [...]
> rmdir("test-rmdir.tdir/file/")                  Err#20 ENOTDIR
> rmdir("test-rmdir.tdir")                        Err#17 EEXIST
> rmdir("test-rmdir.tdir/file")                   Err#20 ENOTDIR
> unlink("test-rmdir.tdir/file")                  = 0
> rmdir("test-rmdir.tdir/.//")                    Err#17 EEXIST
> [...]
>
> If I read Posix correctly, then EEXIST is not allowed for this
> condition; not sure whether gnulib should work around this though.
> Anyway the patch below lets the test pass.  Is it acceptable for gnulib?

Neither is EBUSY.  But at least it fails (even if errno is wrong), so 
your patch is perfectly acceptable given what we've done for other 
syscalls with botched errno values.  Feel free to apply it.

> I've confirmed that the fix is needed for test-unlinkat as well.

Fixing test-rmdir.h should cover both test-rmdir and test-unlinkat in 
one go.

>     ASSERT (func (BASE "dir/.//") == -1);
> -  ASSERT (errno == EINVAL || errno == EBUSY);
> +  ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST);
>     ASSERT (func (BASE "dir") == 0);

--

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Ralf Wildenhues | 25 Aug 2010 23:25
Picon
Picon

Re: debugging M4 on AIX 5.3

Continuing with M4 branch-1.4 failures on AIX 5.3:

 <at>  ../doc/m4.texinfo:5688: Origin of test
../../m4/checks/164.regexp: stdout mismatch
*** m4-tmp.569356/m4-xout       Wed Aug 25 19:05:46 2010
--- m4-tmp.569356/m4-out        Wed Aug 25 19:05:46 2010
***************
*** 1,4 ****
! 5
! -1
  *** Unix *** nix ***

--- 1,4 ----
! 
! 
  *** Unix *** nix ***

 <at>  ../doc/m4.texinfo:5688: Origin of test
../../m4/checks/164.regexp: stderr mismatch
*** 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
+ m4:stdin:2: bad regular expression: `\<Q\w*': Memory exhausted
+ m4:stdin:4: bad regular expression: `\<Q\w*': Memory exhausted
Checking ../../m4/checks/165.regexp
[... several more errors ...]
Failed checks were:
  ../../m4/checks/164.regexp:out ../../m4/checks/164.regexp:err
../../m4/checks/173.patsubst:out ../../m4/checks/173.patsubst:err
../../m4/checks/174.patsubst:out ../../m4/checks/174.patsubst:err
../../m4/checks/231.improved_c:out ../../m4/checks/231.improved_c:err
../../m4/checks/232.improved_c:out ../../m4/checks/232.improved_c:err
make: 1254-004 The error code from the last command is 1.

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 ...

Cheers,
Ralf

Ralf Wildenhues | 28 Aug 2010 09:40
Picon
Picon

Fix malloc, calloc, realloc (was: debugging M4 on AIX 5.3)

* 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.Wildenhues <at> 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
 <at>  <at>  -1,3 +1,9  <at>  <at> 
+2010-08-28  Ralf Wildenhues  <Ralf.Wildenhues <at> gmx.de>
+
+	Tests for module 'calloc'.
+	* modules/calloc-tests: New file.
+	* tests/test-calloc.c: New file.
+
 2010-08-27  Ralf Wildenhues  <Ralf.Wildenhues <at> 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
 <at>  <at>  -0,0 +1,11  <at>  <at> 
+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
 <at>  <at>  -0,0 +1,24  <at>  <at> 
+/* 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.Wildenhues <at> 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
 <at>  <at>  -1,5 +1,9  <at>  <at> 
 2010-08-28  Ralf Wildenhues  <Ralf.Wildenhues <at> 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
 <at>  <at>  -0,0 +1,11  <at>  <at> 
+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
 <at>  <at>  -0,0 +1,24  <at>  <at> 
+/* 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.Wildenhues <at> 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
 <at>  <at>  -1,5 +1,9  <at>  <at> 
 2010-08-28  Ralf Wildenhues  <Ralf.Wildenhues <at> 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
 <at>  <at>  -0,0 +1,11  <at>  <at> 
+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
 <at>  <at>  -0,0 +1,24  <at>  <at> 
+/* 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.Wildenhues <at> 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.Wildenhues <at> 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
 <at>  <at>  -1,5 +1,17  <at>  <at> 
 2010-08-28  Ralf Wildenhues  <Ralf.Wildenhues <at> 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
 <at>  <at>  -18,8 +18,9  <at>  <at> 
 /* 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
 <at>  <at>  -19,8 +19,9  <at>  <at> 
 /* 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
 <at>  <at>  -20,14 +20,16  <at>  <at> 

 #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


Gmane