From b5daaf43bc1ab9f3fe3fa143b00b132c72a9abc3 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 20 May 2016 15:34:26 +0200 Subject: [PATCH] build: configure.ac: always set -fno-strict-aliasing We break the aliasing rules in the code, and thus the flag should always be enabled to prevent wrong optimizations, even without --enable-more-warnings. --- configure.ac | 5 +++++ m4/compiler_options.m4 | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ad9a6e0ae4..e56062a8f7 100644 --- a/configure.ac +++ b/configure.ac @@ -920,6 +920,11 @@ AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes) NM_COMPILER_WARNINGS +CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\ + -fno-strict-aliasing \ +]) +CFLAGS="$CFLAGS $with_cflags" + AC_ARG_ENABLE(more-asserts, AS_HELP_STRING([--enable-more-asserts], [Enable more assertions for debugging (default: no). Deprecated option. Use --with-more-asserts=level])) more_asserts=0 diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index b2472ab81e..496873ea8a 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -66,7 +66,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then -Wfloat-equal -Wno-unused-parameter -Wno-sign-compare \ -Wno-duplicate-decl-specifier \ -Wstrict-prototypes \ - -fno-strict-aliasing -Wno-unused-but-set-variable \ + -Wno-unused-but-set-variable \ -Wundef -Wimplicit-function-declaration \ -Wpointer-arith -Winit-self -Wformat-nonliteral \ -Wmissing-include-dirs -Wno-pragmas; do