From cee499f8670518515875bb1dc4d6284d3681837c Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Thu, 12 Apr 2018 11:36:28 +0800 Subject: [PATCH] DM: fix build issue with gcc 4.8.4 on ubuntu 14.04 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two build issues: - add -fno-strict-aliasing to address error: dereferencing type-punned pointer will break strict-aliasing rules - initialize tfd to zero to address error: ‘tfd’ may be used uninitialized in this function Signed-off-by: Yin Fengwei --- devicemodel/Makefile | 2 +- devicemodel/hw/pci/ahci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devicemodel/Makefile b/devicemodel/Makefile index df7649dd2..6bd3ae57c 100644 --- a/devicemodel/Makefile +++ b/devicemodel/Makefile @@ -16,7 +16,7 @@ CFLAGS += -m64 CFLAGS += -Wall -ffunction-sections CFLAGS += -Werror CFLAGS += -O2 -D_FORTIFY_SOURCE=2 -CFLAGS += -Wformat -Wformat-security +CFLAGS += -Wformat -Wformat-security -fno-strict-aliasing CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/public diff --git a/devicemodel/hw/pci/ahci.c b/devicemodel/hw/pci/ahci.c index 0fa942274..eb27b946a 100644 --- a/devicemodel/hw/pci/ahci.c +++ b/devicemodel/hw/pci/ahci.c @@ -1478,7 +1478,7 @@ static void atapi_mode_sense(struct ahci_port *p, int slot, uint8_t *cfis) { uint8_t *acmd; - uint32_t tfd; + uint32_t tfd = 0; uint8_t pc, code; int len;