From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id A7CA9469710 for ; Wed, 13 May 2020 10:39:03 +0300 (MSK) Received: by mail-lf1-f65.google.com with SMTP id a9so12750233lfb.8 for ; Wed, 13 May 2020 00:39:03 -0700 (PDT) Date: Wed, 13 May 2020 10:39:00 +0300 From: Cyrill Gorcunov Message-ID: <20200513073900.GJ2219@grain> References: <4a2553507fcf643e1e5bae0753d95ee4ff7d4253.1589325991.git.v.shpilevoy@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a2553507fcf643e1e5bae0753d95ee4ff7d4253.1589325991.git.v.shpilevoy@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH small 1/1] rlist: use built-in offsetof() when possible List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org On Wed, May 13, 2020 at 01:27:25AM +0200, Vladislav Shpilevoy wrote: > Rlist implemented its own offsetof() as a classic NULL > pointer cast to the target type with taking address of > the member. So it turned into NULL + member offset. > > But appeared undefined behaviour clang sanitizer is > not friendly to this hack. > > The patch makes rlist define its own offsetof only as > a last resort. > > Part of https://github.com/tarantool/tarantool/issues/4609 I think one day we should gather all such tricks and helpers into compiler.h. Still while we didn't yet Reviewed-by: Cyrill Gorcunov thanks!