From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 9CE4E29C43 for ; Mon, 25 Mar 2019 11:15:04 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XDsHhmKR_ziB for ; Mon, 25 Mar 2019 11:15:04 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 578C51FDE3 for ; Mon, 25 Mar 2019 11:15:04 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 12/13] sql: fixes an error in uint64 to double casting From: "n.pettik" In-Reply-To: Date: Mon, 25 Mar 2019 18:15:01 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: szudin@tarantool.org Merge with one of previous patches. > On 15 Mar 2019, at 18:45, Stanislav Zudin = wrote: >=20 > --- > src/box/sql/util.c | 2 +- > src/box/sql/vdbeInt.h | 2 ++ > src/box/sql/vdbemem.c | 2 +- > 3 files changed, 4 insertions(+), 2 deletions(-) >=20 > diff --git a/src/box/sql/util.c b/src/box/sql/util.c > index 17268aaaa..d585dc0d5 100644 > --- a/src/box/sql/util.c > +++ b/src/box/sql/util.c > @@ -1318,7 +1318,7 @@ sqlAddInt64(i64 * pA, bool is_signedA, i64 iB, = bool is_signedB) > if (sum =3D=3D INT64_MIN_MOD) { > *pA =3D INT64_MIN; > } else { > - assert(sum < INT64_MAX); > + assert(sum <=3D INT64_MAX); > *pA =3D -(i64)sum; > } > return ATHR_SIGNED; > diff --git a/src/box/sql/vdbeInt.h b/src/box/sql/vdbeInt.h > index 42f22df52..2076a9a14 100644 > --- a/src/box/sql/vdbeInt.h > +++ b/src/box/sql/vdbeInt.h > @@ -251,6 +251,8 @@ struct Mem { > #define MEM_Unsigned 0x20000 /* Value is unsigned integer. > * Combine this flag with MEM_Int > * if necessary */ > +#define MEM_UInt (MEM_Int | MEM_Unsigned) > + IMHO it is a terrible mess. Don=E2=80=99t use such macros. If MEM_Unsigned can serve only as an attribute of MEM_Int, then you could declare its value already containing necessary bit.