-
Notifications
You must be signed in to change notification settings - Fork 109
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
incorrect derivative of function that returns struct #1894
Comments
Update: I was asked to try refactoring the wrapper to return by-reference instead of by-value, but that doesn't seem to have changed the output: It's also worth noting that I may just be using |
I showed this to @jandrej and he noticed an important detail: the results are correct when compiling with -O2, but incorrect without it, so maybe it's another inlining issue (and if so, which functions should be forced to inline?) |
update: here's a compiler explorer link with a smaller reproducer implementation |
relevant fix: https://fwd.gymni.ch/r4VfFq |
Thanks for the help @wsmoses! is it technically feasible to emit a warning/error message when this happens? In this case, compiling with optimization seems to produce the right results-- I wonder does that imply that the activity instability arises from the function pointer indirection / wrappers (which requires inlining/optimization to "see through" the indirection)? In the meantime, we'll just append that flag and see how it goes! I'll also ping @SiebenCorgie as I believe they observed a similar-looking issue a few weeks ago (POD data types, simple calculation, diff between derivative in debug/release) in rust. I'll duplicate their report here for completeness
Is there a similar way to enable runtime activity in Rust to see if that resolves the issue above? (or perhaps Sieben has already found resolution) |
https://fwd.gymni.ch/vKIfPx
It seems like some versions of clang are getting the right answers, but others aren't
The text was updated successfully, but these errors were encountered: