From fd9e395e305eb7801086a077c6f2933df4e6fe97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20St=C4=99pie=C5=84?= Date: Thu, 23 Jul 2015 16:25:11 +0200 Subject: [PATCH] Add -fwrapv to CXXFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a following overflow error when compiling with GCC 5: Compiling bignum.cc bignum.cc: In member function ‘void double_conversion::Bignum::AssignDecimalString(double_conversion::Vector)’: bignum.cc:101:6: error: assuming signed overflow does not occur when assuming that (X + c) < X is always false [-Werror=strict-overflow] void Bignum::AssignDecimalString(Vector value) { ^ cc1plus: all warnings being treated as errors From man gcc(1): > -fwrapv > This option instructs the compiler to assume that signed arithmetic > overflow of addition, subtraction and multiplication wraps around > using twos-complement representation. Fixes #97. --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 76c5806..aa1a9a9 100644 --- a/rebar.config +++ b/rebar.config @@ -10,7 +10,7 @@ {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)", "CFLAGS", "$CFLAGS -Ic_src/ -g -Wall -Werror -O3 -fno-strict-aliasing"}, {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)", - "CXXFLAGS", "$CXXFLAGS -Ic_src/ -g -Wall -Werror -O3"}, + "CXXFLAGS", "$CXXFLAGS -Ic_src/ -g -Wall -Werror -O3 -fwrapv"}, {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)", "LDFLAGS", "$LDFLAGS -lstdc++"},