From commits-return-8553-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Mon Oct 12 06:40:55 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 8459518064E for ; Mon, 12 Oct 2020 08:40:55 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id BB151121C3D for ; Mon, 12 Oct 2020 06:40:54 +0000 (UTC) Received: (qmail 49096 invoked by uid 500); 12 Oct 2020 06:40:54 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 49080 invoked by uid 99); 12 Oct 2020 06:40:54 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2020 06:40:54 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id DA71481A7C; Mon, 12 Oct 2020 06:40:53 +0000 (UTC) Date: Mon, 12 Oct 2020 06:40:53 +0000 To: "commits@zookeeper.apache.org" Subject: [zookeeper] branch master updated: ZOOKEEPER-3954: C client: GCC 10 compilation fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <160248485372.29888.9378675937494361694@gitbox.apache.org> From: symat@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: zookeeper X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 3ca408d05c4cc2e038dced1065df844174ac69cf X-Git-Newrev: 6b222fbca9da8795bbf71c7533e5da220831fe92 X-Git-Rev: 6b222fbca9da8795bbf71c7533e5da220831fe92 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. symat pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/zookeeper.git The following commit(s) were added to refs/heads/master by this push: new 6b222fb ZOOKEEPER-3954: C client: GCC 10 compilation fixes 6b222fb is described below commit 6b222fbca9da8795bbf71c7533e5da220831fe92 Author: Damien Diederen AuthorDate: Mon Oct 12 06:40:18 2020 +0000 ZOOKEEPER-3954: C client: GCC 10 compilation fixes The in this PR avoids a confusing and scary compilation issue [encountered by Michael Hudson-Doyle](https://issues.apache.org/jira/browse/ZOOKEEPER-3954) when building the C client with GCC 10 and "aggressive" optimization settings: > `free_auth_completions` is being inlined into `free_completions`, and this lets gcc see that members of `a_list` are being accessed without initialization This is (fortunately!) a red herring: what GCC doesn't see is that, in practice, `zoo_lock_auth` always returns zero, and that `a_list` is always initialized in the conditional block which follows it. That issue is easily "fixed" by removing the `if`. The rest of the client code doesn't check `zoo_lock_auth`'s return value--and we have bigger issues if unconditional locks start failing anyway. See also https://github.com/apache/zookeeper/pull/1481 and https://github.com/apache/zookeeper/pull/1486. Author: Damien Diederen Reviewers: Enrico Olivelli , Mate Szalay-Beko Closes #1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master --- .../zookeeper-client-c/src/zookeeper.c | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/zookeeper-client/zookeeper-client-c/src/zookeeper.c b/zookeeper-client/zookeeper-client-c/src/zookeeper.c index 1728c0e..1327816 100644 --- a/zookeeper-client/zookeeper-client-c/src/zookeeper.c +++ b/zookeeper-client/zookeeper-client-c/src/zookeeper.c @@ -1927,23 +1927,23 @@ void free_completions(zhandle_t *zh,int callCompletion,int reason) } } } - if (zoo_lock_auth(zh) == 0) { - a_list.completion = NULL; - a_list.next = NULL; - get_auth_completions(&zh->auth_h, &a_list); - zoo_unlock_auth(zh); + zoo_lock_auth(zh); + a_list.completion = NULL; + a_list.next = NULL; + get_auth_completions(&zh->auth_h, &a_list); + zoo_unlock_auth(zh); - a_tmp = &a_list; - // chain call user's completion function - while (a_tmp->completion != NULL) { - auth_completion = a_tmp->completion; - auth_completion(reason, a_tmp->auth_data); - a_tmp = a_tmp->next; - if (a_tmp == NULL) - break; - } + a_tmp = &a_list; + // chain call user's completion function + while (a_tmp->completion != NULL) { + auth_completion = a_tmp->completion; + auth_completion(reason, a_tmp->auth_data); + a_tmp = a_tmp->next; + if (a_tmp == NULL) + break; } + free_auth_completion(&a_list); }