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

Work around MSVC issue with std::atomic initialization #4777

Merged
merged 2 commits into from
Jun 18, 2018

Conversation

acozzette
Copy link
Member

MSVC seems to have a bug where it does not use constant initialization
for std::atomic, which ends up causing crashes during initialization.
This change introduces a workaround by putting the std::atomic inside a
union, which causes the compiler to use constant initialization for it.

MSVC seems to have a bug where it does not use constant initialization
for std::atomic, which ends up causing crashes during initialization.
This change introduces a workaround by putting the std::atomic inside a
union, which causes the compiler to use constant initialization for it.
@xfxyjwf
Copy link
Contributor

xfxyjwf commented Jun 18, 2018

Can you include #4772 in this PR so we have the test coverage for this?

@acozzette
Copy link
Member Author

@xfxyjwf Sure, I went ahead and included that change. appveyor.yml is somewhat different between the master and 3.6.x branches, so I couldn't directly cherry-pick your change, but I manually added the same kind of test.

@acozzette acozzette merged commit 885be9c into protocolbuffers:3.6.x Jun 18, 2018
@acozzette acozzette deleted the fix-std-atomic-init branch June 18, 2018 18:38
@xfxyjwf xfxyjwf added the c++ label Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants