From a75816242be2821acdc597619f3e665bb5b64c64 Mon Sep 17 00:00:00 2001 From: Hubert Badocha Date: Tue, 1 Oct 2024 12:29:03 +0200 Subject: [PATCH] Makefile.common: add -fno-strict-aliasing Newer versions of GCC take advantage of strict aliasing rule that we break, without explicitely warning about it. JIRA: RTOS-927, RTOS-932 --- Makefile.common | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.common b/Makefile.common index e7062f0c..bd25f659 100644 --- a/Makefile.common +++ b/Makefile.common @@ -127,6 +127,11 @@ CFLAGS += -Wall -Wstrict-prototypes -fno-common CXXFLAGS += -Wall LDFLAGS += -z noexecstack +# Messages are commonly type-punned - avoid GCC optimizations that might break if strict aliasing rules are not adhered to. +# TODO: Try to minimize surface of code breaking the strict aliasing. +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + # always produce binaries with debug information CFLAGS += -ggdb3 CXXFLAGS += -ggdb3