bug-gnulib
[Top][All Lists]
Advanced

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

Re: test-free: fails with -flto=auto


From: Bruno Haible
Subject: Re: test-free: fails with -flto=auto
Date: Sun, 03 Jan 2021 03:06:09 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Hi Berny,

> Reproducer:
> 
>   $ ./gnulib-tool --create-testdir --dir=/tmp/gl-free --single-configure 
> free-posix \
>        && cd /tmp/gl-free \
>        && env CFLAGS='-O2 -g -flto=auto' LDFLAGS='-O2 -g -flto=auto' 
> ./configure \
>        && make \
>        && make check
> 
> Test failure:
> 
>   $ cat gltests/test-free.log
>   test-free.c:166: assertion 'get_errno_func () == 1789' failed
>   FAIL test-free (exit status: 134)
> 
> Without "-flto=auto" flag, the build+test passes.
> This is the relevant 'strace' output:
> 
>   $ cd gltests \
>       && strace ./test-free 2>&1 \
>            | grep -C2 munmap \
>            | tail -n5
>   mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7f4f33e4c000
>   mmap(NULL, 4096, PROT_READ, MAP_PRIVATE, 4, 0) = -1 ENOMEM (Cannot allocate 
> memory)
>   munmap(0x7f4f43e10000, 16777216)        = -1 ENOMEM (Cannot allocate memory)

So far this is all as expected.

>   write(2, "test-free.c", 11test-free.c)             = 11
>   write(2, ":", 1:)                        = 1

What was the result of
  'checking whether free is known to preserve errno...'
in your build?

If it was 'yes', you've got a problem with the configure test.

If it was 'no', it seems that you are hitting this GCC bug:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98396
LTO makes it harder to work around it. Can you try it nevertheless (by modifying
the code in such a way that it disables the wrong optimization, especially in
lib/free.c)?

> BTW: I noticed that the __linux__ part of this test is only run if 'gltests'
> is the working directory, because the test relies on "test-free" being 
> readable.
> Is that intended?

Yes. Many of our tests (especially the shell scripts) assume that they get run
in the build directory. This test is no exception.

Bruno




reply via email to

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