projects/aports·blob master · refs

55 lines · 2.7 KiB

1From: Lee Duncan <[email protected]>
2Date: Thu, 11 Feb 2021 11:34:42 -0800
3Subject: [PATCH] Fix test issue with gcc-11
4MIME-Version: 1.0
5Content-Type: text/plain; charset=UTF-8
6Content-Transfer-Encoding: 8bit
7
8Test 3.t exercises io_submit() with invalid addresses,
9and one test attempted to pass in "-1" as an invalid
10pointer. But gcc-11 realizes you cannot take an offset
11from an invalid pointer, making it impossible to
12compile or run this test:
13
14> sh# make CC=gcc-11 partcheck
15> make[1]: Entering directory '/alt/public_software/libaio/src'
16> make[1]: Nothing to be done for 'all'.
17> make[1]: Leaving directory '/alt/public_software/libaio/src'
18> make[1]: Entering directory '/alt/public_software/libaio/harness'
19> gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/2.t\" -o cases/2.p main.c ../src/libaio.a -lpthread
20> gcc-11 -Wall -Werror -I../src -g -O2 -DTEST_NAME=\"cases/3.t\" -o cases/3.p main.c ../src/libaio.a -lpthread
21> In file included from main.c:24:
22> cases/3.t: In function ‘test_main’:
23> cases/3.t:18:19: error: ‘attempt_io_submit’ accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]
24> 18 | status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT);
25> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26> cases/3.t:18:19: note: referencing argument 3 of type ‘struct iocb **’
27> In file included from cases/3.t:5,
28> from main.c:24:
29> cases/aio_setup.h:15:5: note: in a call to function ‘attempt_io_submit’
30> 15 | int attempt_io_submit(io_context_t ctx, long nr, struct iocb *ios[], int expect)
31> | ^~~~~~~~~~~~~~~~~
32> cc1: all warnings being treated as errors
33> make[1]: *** [Makefile:19: cases/3.p] Error 1
34> make[1]: Leaving directory '/alt/public_software/libaio/harness'
35> make: *** [Makefile:23: partcheck] Error 2
36
37The fix is to remove this one test case, since the compiler now
38ensures the running code will never see this case.
39
40Signed-off-by: Lee Duncan <[email protected]>
41---
42 harness/cases/3.t | 1 -
43 1 file changed, 1 deletion(-)
44
45diff -Nurp a/harness/cases/3.t b/harness/cases/3.t
46--- a/harness/cases/3.t 2018-10-22 20:59:34.000000000 +0100
47+++ b/harness/cases/3.t 2022-02-26 09:46:51.969845084 +0000
48@@ -15,7 +15,6 @@ int test_main(void)
49 status |= attempt_io_submit(BAD_CTX, 1, good_ios, -EINVAL);
50 status |= attempt_io_submit( io_ctx, 0, good_ios, 0);
51 status |= attempt_io_submit( io_ctx, 1, NULL, -EFAULT);
52- status |= attempt_io_submit( io_ctx, 1, (void *)-1, -EFAULT);
53 status |= attempt_io_submit( io_ctx, 2, bad1_ios, -EFAULT);
54 status |= attempt_io_submit( io_ctx, 2, bad2_ios, -EFAULT);
55 status |= attempt_io_submit( io_ctx, -1, good_ios, -EINVAL);