From 80a5676783ae982b0b0be2908ea8e6bfb4c5dd6c Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 4 Aug 2007 00:45:53 +0000 Subject: [PATCH] (svn r10779) -Fix: GCC 4.2 makes (by default for -O2, -O3 and -Os) an assumption that signed integers do not overflow, whereas it is very likely that some of the legacy code does so. It furthermore breaks with the assumed standard (the behaviour is not actually defined in the standard) about the behaviour when signed integers wrap. --- config.lib | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config.lib b/config.lib index e84f48d919..e814df7ef8 100644 --- a/config.lib +++ b/config.lib @@ -838,6 +838,14 @@ make_cflags_and_ldflags() { CFLAGS="$CFLAGS -fno-strict-aliasing" fi + # GCC 4.2+ automatically assumes that signed overflows do + # not occur in signed arithmetics, whereas we are not + # sure that they will not happen. It furthermore complains + # about it's own optimized code in some places. + if [ $cc_version -ge 42 ]; then + CFLAGS="$CFLAGS -fno-strict-overflow" + fi + if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then LIBS="$LIBS -lpthread" LIBS="$LIBS -lrt"