From 35d91694b32ea4e1f50dafe5d9e07ec4ea881950 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Jun 13 2016 13:43:31 +0000 Subject: Fix regression with GCC 6.x.y Signed-off-by: Peter Lemenkov --- diff --git a/erlang.spec b/erlang.spec index a5a987e..5b5fd1e 100644 --- a/erlang.spec +++ b/erlang.spec @@ -69,7 +69,7 @@ Name: erlang Version: 18.3.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: General-purpose programming language and runtime environment Group: Development/Languages @@ -128,6 +128,9 @@ Patch8: otp-0008-Add-patch-to-crash-dump-on-large-distribution.patch # Fedora specific patch # Don't send unasked for systemd notifications Patch9: otp-0009-Don-t-send-unasked-for-systemd-notifications.patch +# Fedora specific patch +# Fix decoding of LLONG_MIN in erl_decode +Patch10: otp-0010-Fix-decoding-of-LLONG_MIN-in-erl_decode.patch # end of autogenerated patch tag list BuildRequires: flex @@ -1025,6 +1028,7 @@ Erlang mode for XEmacs (source lisp files). %patch7 -p1 -b .Split_off_webtool_dependency_from_tools %patch8 -p1 -b .Add_patch_to_crash_dump_on_large_distribution %patch9 -p1 -b .Don_t_send_unasked_for_systemd_notifications +%patch10 -p1 -b .Fix_decoding_of_LLONG_MIN_in_erl_decode # end of autogenerated prep patch list # FIXME we should come up with a better solution @@ -2445,6 +2449,9 @@ useradd -r -g epmd -d /tmp -s /sbin/nologin \ %changelog +* Mon Jun 13 2016 Peter Lemenkov - 18.3.3-2 +- Fix regression with GCC 6.x.y + * Wed May 11 2016 Peter Lemenkov - 18.3.3-1 - Ver. 18.3.3 diff --git a/otp-0010-Fix-decoding-of-LLONG_MIN-in-erl_decode.patch b/otp-0010-Fix-decoding-of-LLONG_MIN-in-erl_decode.patch new file mode 100644 index 0000000..d832978 --- /dev/null +++ b/otp-0010-Fix-decoding-of-LLONG_MIN-in-erl_decode.patch @@ -0,0 +1,69 @@ +From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= +Date: Fri, 10 Jun 2016 16:40:38 +0200 +Subject: [PATCH] Fix decoding of LLONG_MIN in erl_decode + +Reported-by: Peter Lemenkov + +diff --git a/lib/erl_interface/src/legacy/erl_marshal.c b/lib/erl_interface/src/legacy/erl_marshal.c +index a4216c9..6a1b573 100644 +--- a/lib/erl_interface/src/legacy/erl_marshal.c ++++ b/lib/erl_interface/src/legacy/erl_marshal.c +@@ -727,6 +727,13 @@ static ETERM *erl_decode_it(unsigned char **ext) + ((*ext)[2]) << 8 |((*ext)[3]); + *ext += 4; + big_cont: ++ ++#ifdef _MSC_VER ++#define MAX_TO_NEGATE 0x8000000000000000Ui64 ++#else ++#define MAX_TO_NEGATE 0x8000000000000000ULL ++#endif ++ + sign = *(*ext)++; + if (arity > 8) + goto big_truncate; +@@ -763,23 +770,28 @@ static ETERM *erl_decode_it(unsigned char **ext) + *ext += arity; + return ep; + } else { +- /* Fits in a long long */ +- int x; +- long long l = 0LL; +- +- for(x = 0 ; x < arity ; x++) { +- l |= ((long long)(*ext)[x]) << ((long long)(8*x)); +- } +- if (sign) { +- l = -l; +- if (l > 0) goto big_truncate; +- } +- +- ERL_TYPE(ep) = ERL_LONGLONG; +- ep->uval.llval.i = l; +- *ext += arity; +- return ep; ++ /* Fits in a signed long long */ ++ int x; ++ unsigned long long l = 0LL; ++ long long sl; ++ ++ for(x = 0 ; x < arity ; x++) { ++ l |= ((unsigned long long)(*ext)[x]) << ((unsigned long long)(8*x)); ++ } ++ ++ sl = (long long)l; ++ ++ if (sign && l != MAX_TO_NEGATE) { ++ sl = -sl; ++ if (sl > 0) goto big_truncate; ++ } ++ ++ ERL_TYPE(ep) = ERL_LONGLONG; ++ ep->uval.llval.i = sl; ++ *ext += arity; ++ return ep; + } ++#undef MAX_TO_NEGATE + big_truncate: + /* truncate to: (+/-) 1 */ + #ifdef DEBUG