[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [qemu-xen staging-4.17] async: Suppress GCC13 false positive in aio_bh_poll()
commit ffb451126550b22b43b62fb8731a0d78e3376c03 Author: Cédric Le Goater <clg@xxxxxxxxxx> AuthorDate: Thu Apr 20 22:29:39 2023 +0200 Commit: Anthony PERARD <anthony.perard@xxxxxxxxxx> CommitDate: Fri Jul 21 11:57:33 2023 +0100 async: Suppress GCC13 false positive in aio_bh_poll() GCC13 reports an error : ../util/async.c: In function â??aio_bh_pollâ??: include/qemu/queue.h:303:22: error: storing the address of local variable â??sliceâ?? in â??*ctx.bh_slice_list.sqh_lastâ?? [-Werror=dangling-pointer=] 303 | (head)->sqh_last = &(elm)->field.sqe_next; \ | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ ../util/async.c:169:5: note: in expansion of macro â??QSIMPLEQ_INSERT_TAILâ?? 169 | QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, &slice, next); | ^~~~~~~~~~~~~~~~~~~~ ../util/async.c:161:17: note: â??sliceâ?? declared here 161 | BHListSlice slice; | ^~~~~ ../util/async.c:161:17: note: â??ctxâ?? declared here But the local variable 'slice' is removed from the global context list in following loop of the same routine. Add a pragma to silent GCC. Cc: Stefan Hajnoczi <stefanha@xxxxxxxxxx> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> Cc: Daniel P. Berrangé <berrange@xxxxxxxxxx> Signed-off-by: Cédric Le Goater <clg@xxxxxxxxxx> Reviewed-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> Reviewed-by: Philippe Mathieu-Daudé <philmd@xxxxxxxxxx> Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx> Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx> Tested-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> Message-Id: <20230420202939.1982044-1-clg@xxxxxxxx> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> (cherry picked from commit d66ba6dc1cce914673bd8a89fca30a7715ea70d1) --- util/async.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/util/async.c b/util/async.c index 2ea1172f3e..0b3bf38e9d 100644 --- a/util/async.c +++ b/util/async.c @@ -150,7 +150,21 @@ int aio_bh_poll(AioContext *ctx) int ret = 0; QSLIST_MOVE_ATOMIC(&slice.bh_list, &ctx->bh_list); + + /* + * GCC13 [-Werror=dangling-pointer=] complains that the local variable + * 'slice' is being stored in the global 'ctx->bh_slice_list' but the + * list is emptied before this function returns. + */ +#if !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wdangling-pointer=" +#endif QSIMPLEQ_INSERT_TAIL(&ctx->bh_slice_list, &slice, next); +#if !defined(__clang__) +#pragma GCC diagnostic pop +#endif while ((s = QSIMPLEQ_FIRST(&ctx->bh_slice_list))) { QEMUBH *bh; -- generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.17
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |