Repository navigation
Wrap multivar_func callback in adaptive_integration - #104
Open
mkruskal-google wants to merge 1 commit into
Open
mkruskal-google wants to merge 1 commit into
mkruskal-google wants to merge 1 commit into
Conversation
Calling `multivar_func` (`double (*)(int, double *, void *)`) through a cast to `integrand` (`double (*)(unsigned, const double *, void *)`) causes indirect-call signature mismatches (`-Wcast-function-type-strict`, `-fsanitize=function`, `-fsanitize=kcfi`). Use a stack-allocated `num_wrap_data` struct and `num_wrap` trampoline matching `integrand` (analogous to `cnum_wrap` in `src/cintegrator.c`), leaving the public `multivar_func` typedef and `adaptive_integration` API unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
src/integrator.c,adaptive_integrationpreviously cast its callback to the internal integrand pointer type despite mismatched parameter signedness and const qualification. This adds a stack-allocated wrapper struct and static trampoline mirroringsrc/cintegrator.c, leaving the public C API unchanged. Standalone C builds compile cleanly under strict function-pointer cast warnings, and standalone integrator and geometry test builds pass under Clang indirect-call sanitizers. The integrator harness also passes under undefined-behavior checks, and those geometry tests pass under GCC with OpenMP.Note: Drafted and locally tested with AI coding assistance.