Skip to content

Conversation

@zhykzhykzhyk
Copy link

Solves #323

@CreoValis
Copy link

Wouldn't access through a volatile * be a better solution here? The "no inline" spec probably works around the issue, but that just seems to push the dtor body to the point where gcc couldn't "see into it" to optimize it away.
I think using a volatile pointer cast would forbid it from even optimizing it away.

Like so:

    manage_exception_state() {
        exception_state_ = *(volatile __cxa_eh_globals *)__cxa_get_globals();
    }
    ~manage_exception_state() {
        *(volatile __cxa_eh_globals *)__cxa_get_globals() = exception_state_;
    }
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants