
* configure.ac: Set STRICT_ALIASING_CXXFLAGS to `-fno-strict-aliasing' when the compiler is g++ 4.2. --- ChangeLog | 7 +++++++ configure.ac | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4a90d0..04d59b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-04-23 Roland Levillain <roland@lrde.epita.fr> + + Work around g++ 4.2's behavior regarding strict aliasing. + + * configure.ac: Set STRICT_ALIASING_CXXFLAGS to + `-fno-strict-aliasing' when the compiler is g++ 4.2. + 2010-04-21 Roland Levillain <roland@lrde.epita.fr> Catch up with the new interface of Scribo's unit tests generator. diff --git a/configure.ac b/configure.ac index d9953c5..e83a6eb 100644 --- a/configure.ac +++ b/configure.ac @@ -47,10 +47,25 @@ fi AC_LANG([C++]) AC_PROG_CXX -# Speed up compiling times. +# GNU C++ compiler setup. if test "$GXX" = yes; then + # Speed up compiling times. CXXFLAGS="$CXXFLAGS -pipe" + + # The code generated for mln::data::impl::memcpy__() by g++ 4.2 with + # a high optimization level (`-O3') and without + # `-fno-strict-aliasing' might be wrong, at least with Debian's g++ + # 4.2 on IA-32 (see also milena/mln/memcpy_.hh). We observed this + # behavior with e.g. milena/apps/graph-morpho/samples-image2d.cc. + # Note that Debian's g++ 4.0, 4.1, 4.3 and 4.4 are fine. + # + # So, when the C++ compiler is g++ 4.2, set STRICT_ALIASING_CXXFLAGS + # to `-fno-strict-aliasing'. + if $CXX --version | head -n 1 | grep '\b4\.2' >/dev/null 2>&1; then + STRICT_ALIASING_CXXFLAGS=-fno-strict-aliasing + fi fi +AC_SUBST([STRICT_ALIASING_CXXFLAGS]) # Adjusting warning options according to compilers. -- 1.5.6.5