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

Fix hang after 8 hours with certain compilers #987

Merged
merged 5 commits into from
Nov 25, 2024
Merged

Conversation

terrillmoore
Copy link
Member

Per issue #968, some recent compilers get confused by the integer comparison if ( (txbeg - (now + TX_RAMPUP)) < 0) comparison which appears in engine_update_inner(). Apparently, the macro expansion for TX_RAMPUP (which involves a call to us2osticks(), which is again a macro) causes the expression to be promoted to int64_t despite the explicit type casts on the result.

Not surprisingly, adding more typecasts doesn't help. What helps is computing txbeg - (now + TX_RAMPUP)) , assigning the result to a volatile osticks_t variable, and then checking that. volatile forces the assignment to actually take effect, and osticks_t is the 32-bit integral type we want.

@terrillmoore terrillmoore self-assigned this Nov 25, 2024
@terrillmoore terrillmoore merged commit 2e04c8e into master Nov 25, 2024
8 checks passed
@terrillmoore terrillmoore deleted the issue968 branch November 25, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant