qemu fails to compile on gcc 9 `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
Qemu compilation fails with below error on ppc64le host with gcc 9(9.0.1 20190328)
repo: https:/
branch: master
commit e1be98540ee672e
CC net/dump.o
hw/usb/dev-mtp.c: In function ‘usb_mtp_
hw/usb/
1708 | dataset->filename);
| ~~~~~~~^~~~~~~~~~
cc1: all warnings being treated as errors
CC net/eth.o
make: *** [/home/
make: *** Waiting for unfinished jobs....
CC net/announce.o
tags: | added: compilation gcc9 |
Changed in qemu: | |
status: | Fix Committed → Fix Released |
Tried to patch as below and it compiles fine, not sure if this is right fix though,
# git diff
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index ebf210f..7d512e5 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -231,7 +231,7 @@ typedef struct {
char date_modified[0]; /*unused*/
char keywords[0]; /*unused*/
/* string and other data follows */
-} QEMU_PACKED ObjectInfo;
+} ObjectInfo;
#define TYPE_USB_MTP "usb-mtp" CHECK(MTPState, (obj), TYPE_USB_MTP)
#define USB_MTP(obj) OBJECT_