On 5/7/20 7:11 AM, Philippe Mathieu-Daudé wrote:
Fix when building with -Os:
CC block/block-copy.o
block/block-copy.c: In function ‘block_copy_task_entry’:
block/block-copy.c:428:38: error: ‘error_is_read’ may be used uninitialized
in this function [-Werror=maybe-uninitialized]
428 | t->call_state->error_is_read = error_is_read;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Looks like -Os triggered different inlining of block_copy_do_copy(). I
confirm that block_copy_do_copy does NOT initialize error_is_read except
when returning < 0, but similarly block_copy_task_entry() does not read
error_is_read except in the same setups. So it looks like no actual bug
was triggered, but we can definitely aid the compiler's analysis by
initializing.
Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com>
---
block/block-copy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <ebl...@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org