[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
test-free: fails with -flto=auto
From: |
Bernhard Voelker |
Subject: |
test-free: fails with -flto=auto |
Date: |
Sun, 3 Jan 2021 00:42:55 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 |
Hi Bruno,
wondering why my build failed with the new free-posix module pulled in
on openSUSE's build system, I tracked it down to the LTO compiler option.
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)
write(2, "test-free.c", 11test-free.c) = 11
write(2, ":", 1:) = 1
I don't know much about LTO - only that openSUSE turned it on maybe last spring.
So it could well be a GCC compiler issue.
Do you have an idea?
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? Or could that be a problem in some environments?
$ cat -n test-free.c | grep -A5 test-free
125 int fd = open ("test-free", O_RDONLY);
126
127 if (firstpage_backup != NULL && lastpage_backup != NULL
128 && bumper_region != (void *)(-1)
129 && fd >= 0)
130 {
Thanks & have a nice day,
Berny
- test-free: fails with -flto=auto,
Bernhard Voelker <=