qemu fails to compile on gcc 9 "block/nvme.c:209:22: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Issue:
Qemu compilation fails with below error on ppc64le host with gcc 9, repo(https:/
CHK version_gen.h
CC block/nvme.o
block/nvme.c: In function ‘nvme_create_
block/nvme.
209 | q->sq.doorbell = &s->regs-
| ^~~~~~~
block/nvme.
216 | q->cq.doorbell = &s->regs-
| ^~~~~~~
cc1: all warnings being treated as errors
make: *** [/usr/share/
+++++++
$git commit:
commit 0483e90393bac85
Author: Thomas Huth <email address hidden>
Date: Thu Feb 21 12:24:48 2019 +0100
hw/ppc: Use object_
Both functions, object_initialize() and object_
the reference counter of the new object, so one of the references has to be
dropped afterwards to get the reference counting right. Otherwise the child
object will not be properly cleaned up when the parent gets destroyed.
Thus let's use now object_
counting here right.
Suggested-by: Eduardo Habkost <email address hidden>
Signed-off-by: Thomas Huth <email address hidden>
Message-Id: <email address hidden>
Reviewed-by: Cédric Le Goater <email address hidden>
Signed-off-by: David Gibson <email address hidden>
+++++++
Note: Same commit on a different ppc64le host with gcc(8.1.1 20180712) compile without any issue.
Host Env:
Power8
#lscpu
Architecture: ppc64le
Byte Order: Little Endian
CPU(s): 160
On-line CPU(s) list: 0,8,16,
Off-line CPU(s) list: 1-7,9-15,
Thread(s) per core: 1
Core(s) per socket: 5
Socket(s): 4
NUMA node(s): 4
Model: 2.1 (pvr 004b 0201)
Model name: POWER8E (raw), altivec supported
CPU max MHz: 3690.0000
CPU min MHz: 2061.0000
L1d cache: 64K
L1i cache: 32K
L2 cache: 512K
L3 cache: 8192K
NUMA node0 CPU(s): 0,8,16,24,32
NUMA node1 CPU(s): 40,48,56,64,72
NUMA node16 CPU(s): 80,88,96,104,112
NUMA node17 CPU(s): 120,128,136,144,152
# gcc --version
gcc (GCC) 9.0.1 20190209 (Red Hat 9.0.1-0.4)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# uname -r
5.0.0-rc7-
description: | updated |
Changed in qemu: | |
status: | Fix Committed → Fix Released |
The fields of the struct are naturally aligned, so this should be easy enough to fix just by dropping QEMU_PACKED (we already have a compile-time assert that the doorbells field is at the expected address).
NB: I notice also the struct is marked 'volatile' -- this is a bit of a red flag that the code may not really be doing the right thing here.