bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-idutils] [PATCH 1/9] tests: disable gnulib's get-rusage-as test


From: Bruno Haible
Subject: Re: [bug-idutils] [PATCH 1/9] tests: disable gnulib's get-rusage-as test
Date: Sat, 04 Feb 2012 12:59:27 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Hi Jim,

> setrlimit(RLIMIT_AS, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0
> getrlimit(RLIMIT_AS, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0

No brk() calls. It looks really like GCC has optimized out the two malloc()
calls. And indeed, with a recent GCC 4.7 snapshot I reproduce the problem.

A workaround would be to use -fno-builtin-malloc. But I can just as well
disable the optimization in the test:


2012-02-04  Bruno Haible  <address@hidden>

        get-rusage-as, get-rusage-data tests: Avoid test failure with gcc-4.7.
        * tests/test-get-rusage-as.c (main): Assign the malloc() results to
        global variables.
        * tests/test-get-rusage-data.c (main): Likewise.
        Reported by Jim Meyering.

--- tests/test-get-rusage-as.c.orig     Sat Feb  4 12:58:13 2012
+++ tests/test-get-rusage-as.c  Sat Feb  4 12:51:53 2012
@@ -23,6 +23,9 @@
 
 #include "macros.h"
 
+void *memchunk1;
+void *memchunk2;
+
 int
 main ()
 {
@@ -30,11 +33,11 @@
 
   value1 = get_rusage_as ();
 
-  malloc (0x88);
+  memchunk1 = malloc (0x88);
 
   value2 = get_rusage_as ();
 
-  malloc (0x281237);
+  memchunk2 = malloc (0x281237);
 
   value3 = get_rusage_as ();
 
--- tests/test-get-rusage-data.c.orig   Sat Feb  4 12:58:13 2012
+++ tests/test-get-rusage-data.c        Sat Feb  4 12:52:38 2012
@@ -23,6 +23,9 @@
 
 #include "macros.h"
 
+void *memchunk1;
+void *memchunk2;
+
 int
 main ()
 {
@@ -30,11 +33,11 @@
 
   value1 = get_rusage_data ();
 
-  malloc (0x88);
+  memchunk1 = malloc (0x88);
 
   value2 = get_rusage_data ();
 
-  malloc (0x281237);
+  memchunk2 = malloc (0x281237);
 
   value3 = get_rusage_data ();
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]