Skip to contentSkip to conversation

Makefile: Compile the kvm-unit-tests with -fno-strict-aliasing

PATCH In review Thomas Huth 3 participants 4 messages Jan 22, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Compile the kvm-unit-tests with -fno-strict-aliasing

Strict aliasing bugs are often hard to find and understand (when the compiler did not omit a warning), and kvm-unit-tests are mainly written by kernel developers who are used to compile their code with -fno-strict-aliasing. So let's use this flag for the kvm-unit-tests, too.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 4c716da..3834a12 100644
@@ -49,7 +49,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
 cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
-COMMON_CFLAGS += -g $(autodepend-flags)
+COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing
 COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
 COMMON_CFLAGS += -Wignored-qualifiers -Werror
 
Signature · 1 line
2.18.1
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Thomas Huth

Strict aliasing bugs are often hard to find and understand (when the compiler did not omit a warning), and kvm-unit-tests are mainly written by kernel developers who are used to compile their code with -fno-strict-aliasing. So let's use this flag for the kvm-unit-tests, too.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +0 -0
index 4c716da..3834a12 100644

Makefile include $(SRCDIR)/$(TEST_DIR)/Makefile · line 54

Quoted 7 lines
Makefile +1 -1
@@ -49,7 +49,7 @@ include $(SRCDIR)/$(TEST_DIR)/Makefile
 cc-option = $(shell if $(CC) -Werror $(1) -S -o /dev/null -xc /dev/null \
               > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
 
-COMMON_CFLAGS += -g $(autodepend-flags)
+COMMON_CFLAGS += -g $(autodepend-flags) -fno-strict-aliasing
 COMMON_CFLAGS += -Wall -Wwrite-strings -Wempty-body -Wuninitialized
 COMMON_CFLAGS += -Wignored-qualifiers -Werror
Signature · 3 lines
Thanks,

David / dhildenb