Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZOOKEEPER-3954: C client: GCC 10 compilation fixes #1487

Closed

Conversation

ztzg
Copy link
Contributor

@ztzg ztzg commented Oct 6, 2020

The in this PR avoids a confusing and scary compilation issue encountered by Michael Hudson-Doyle 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 #1481 and #1486.

…ining

Michael Hudson-Doyle experienced an error while compiling 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.

Let's "fix" this 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.
@ztzg ztzg changed the title ZOOKEEPER-3954: C client: Avoid compilation issue with aggressive inl… ZOOKEEPER-3954: C client: GCC 10 compilation fixes Oct 6, 2020
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor

@symat symat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, +1

@symat
Copy link
Contributor

symat commented Oct 12, 2020

I'm going to merge this PR, plus the others open for branch-3.6 and 3.5)
@eolivelli is it OK for you? (you +1 this one, but not the other two: #1486 #1481)

@asfgit asfgit closed this in 6b222fb Oct 12, 2020
@eolivelli
Copy link
Contributor

Ok for all of them

@ztzg
Copy link
Contributor Author

ztzg commented Oct 12, 2020

Thanks!

RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
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 apache#1481 and apache#1486.

Author: Damien Diederen <dd@crosstwine.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
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 apache#1481 and apache#1486.

Author: Damien Diederen <dd@crosstwine.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
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 apache#1481 and apache#1486.

Author: Damien Diederen <dd@crosstwine.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
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 apache#1481 and apache#1486.

Author: Damien Diederen <dd@crosstwine.com>

Reviewers: Enrico Olivelli <eolivelli@apache.org>, Mate Szalay-Beko <symat@apache.org>

Closes apache#1487 from ztzg/ZOOKEEPER-3954-gcc10-compilation-fixes-master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants