[PATCH libaio] Fix test issue with gcc-11
authorLee Duncan <lduncan@suse.com>
Sun, 14 Feb 2021 22:59:07 +0000 (14:59 -0800)
committerGuillem Jover <guillem@debian.org>
Thu, 11 Nov 2021 03:56:01 +0000 (03:56 +0000)
commit5032747e295a2a12fba1582ce1b5d3236ca4c46f
tree5b37bf606b4bceab4c6d87a61df3079846043da5
parentd3121b2ddf2e65ad54a61b98a040cff6ca232658
[PATCH libaio] Fix test issue with gcc-11

Test 3.t exercises io_submit() with invalid addresses,
and one test attempted to pass in "-1" as an invalid
pointer. But gcc-11 realizes you cannot take an offset
from an invalid pointer, making it impossible to
compile or run this test:

> sh# make CC=gcc-11 partcheck
> make[1]: Entering directory '/alt/public_software/libaio/src'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory '/alt/public_software/libaio/src'
> make[1]: Entering directory '/alt/public_software/libaio/harness'
> gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/2.t\" -o cases/2.p main.c ../src/libaio.a -lpthread
> gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/3.t\" -o cases/3.p main.c ../src/libaio.a -lpthread
> In file included from main.c:24:
> cases/3.t: In function ‘test_main’:
> cases/3.t:18:19: error: ‘attempt_io_submit’ accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]
>    18 |         status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT);
>       |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cases/3.t:18:19: note: referencing argument 3 of type ‘struct iocb **’
> In file included from cases/3.t:5,
>                  from main.c:24:
> cases/aio_setup.h:15:5: note: in a call to function ‘attempt_io_submit’
>    15 | int attempt_io_submit(io_context_t ctx, long nr, struct iocb *ios[], int expect)
>       |     ^~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[1]: *** [Makefile:19: cases/3.p] Error 1
> make[1]: Leaving directory '/alt/public_software/libaio/harness'
> make: *** [Makefile:23: partcheck] Error 2

The fix is to tell gcc to relax it's stringop overflow
testing for this one test.

Changes since v1:
* First version just skipped the test in question

Signed-off-by: Lee Duncan <leeman.duncan@gmail.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Gbp-Pq: Topic upstream
Gbp-Pq: Name 0001-Fix-test-issue-with-gcc-11.patch
harness/Makefile