[glib] build: Enable -fno-strict-aliasing



commit ade324f6fa6274fd2a925b4c8f9cb0ee4956a27f
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Dec 21 17:49:05 2017 +0000

    build: Enable -fno-strict-aliasing
    
    GLib makes various assumptions about aliasing throughout its codebase,
    and compiling with -fstrict-aliasing has been demonstrated to cause
    problems (for example, bug #791622). Explicitly disable strict aliasing
    as a result.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 configure.ac |    8 ++++++++
 meson.build  |    4 ++++
 2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c0d2935..b28dbfb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2630,6 +2630,14 @@ AS_IF([ test "x$use_gcov" = "xyes"], [
   LDFLAGS="$LDFLAGS -lgcov"
 ])
 
+dnl *******************************
+dnl *** Disable strict aliasing ***
+dnl *******************************
+dnl See https://bugzilla.gnome.org/show_bug.cgi?id=791622
+AS_IF([test "${GCC}" = "yes"],[
+  CFLAGS="$CFLAGS -fno-strict-aliasing"
+])
+
 dnl ******************************
 dnl *** output the whole stuff ***
 dnl ******************************
diff --git a/meson.build b/meson.build
index d99eda3..e35b54d 100644
--- a/meson.build
+++ b/meson.build
@@ -63,6 +63,10 @@ glib_pkgconfigreldir = join_paths(glib_libdir, 'pkgconfig')
 
 add_project_arguments('-D_GNU_SOURCE', language: 'c')
 
+# Disable strict aliasing;
+# see https://bugzilla.gnome.org/show_bug.cgi?id=791622
+add_project_arguments('-fno-strict-aliasing', language: 'c')
+
 ########################
 # Configuration begins #
 ########################


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]