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

Trouble with myDebugFunction on aarch64 #131

Open
pierrewillenbrockdfki opened this issue Jun 1, 2023 · 0 comments
Open

Trouble with myDebugFunction on aarch64 #131

pierrewillenbrockdfki opened this issue Jun 1, 2023 · 0 comments

Comments

@pierrewillenbrockdfki
Copy link
Contributor

When trying to run mars on aarch64, mars segfaults once ODE starts its simulation. The root cause is a misstated assertion in ode, but there is also a fault in mars itself.

The segfault happens when ode calls its dDebug function, which then calls whatever has been assigned to odes debug_function, which happens to be mars::sim::myDebugFunction. Since dDebug is marked noreturn, when it would try to return(which triggers undefined behavior), the compiler instead put in a call to dMessage(which happens to be the next function in the file), which then has an incorrect stack/parameter layout and causes the segfault later(char const *msg parameter is 1).

Since dDebug does not prevent returning if a debug_function is present, i conclude that the debug_function is supposed to not return, thus, mars::sim::myDebugFunction (and mars::sim::myErrorFunction) should not return.

The issue in ode-16 is that they assumed ~((atomicord32)0) equals 0xffffffff, while it does equal -1(atomicord32 is an int32_t in this case). Thus, dICHECK(nj < ~((atomicord32)0) / dJCB__MAX) always triggers.

Apart from that, runs great, if not very fast.

@malter

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

No branches or pull requests

1 participant