Skip to content

fix: resolve LTO type mismatch for R_igraph_eigen_matrix, R_igraph_eigen_matrix_symmetric, and R_igraph_get_shortest_path_astar#2619

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/fix-igraph-install-warnings
Draft

fix: resolve LTO type mismatch for R_igraph_eigen_matrix, R_igraph_eigen_matrix_symmetric, and R_igraph_get_shortest_path_astar#2619
Copilot wants to merge 1 commit intomainfrom
copilot/fix-igraph-install-warnings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Summary

Fixes the following LTO type mismatch warnings reported during package installation:

cpp11.cpp:173:13: warning: type of 'R_igraph_eigen_matrix_symmetric' does not match original declaration [-Wlto-type-mismatch]
cpp11.cpp:172:13: warning: type of 'R_igraph_eigen_matrix' does not match original declaration [-Wlto-type-mismatch]
cpp11.cpp:215:13: warning: type of 'R_igraph_get_shortest_path_astar' does not match original declaration [-Wlto-type-mismatch]

Root Cause

The ARPACKFUNC and ASTAR_HEURISTIC_FUNC types in tools/stimulus/types-RC.yaml had HEADER: {} (an empty dict, which is falsy in Python), causing Stimulus to omit these parameters from the C function signatures in the generated rinterface.c. However:

  • The R wrappers in aaa-auto.R correctly included these as .Call() arguments (because types-RR.yaml has no HEADER override for these types, so Stimulus defaults to using the parameter name)
  • cpp11.cpp is auto-generated to match the R call argument counts

This created a mismatch: cpp11.cpp declared/registered R_igraph_eigen_matrix and R_igraph_eigen_matrix_symmetric with 7 parameters and R_igraph_get_shortest_path_astar with 6, but the corresponding C functions in rinterface.c had 6 and 5 parameters respectively.

Fix

Changed HEADER: {} to HEADER: '%I%' for ARPACKFUNC and ASTAR_HEURISTIC_FUNC in tools/stimulus/types-RC.yaml, then regenerated src/rinterface.c. The C functions now accept the SEXP parameters in their signatures (fixing the LTO mismatch) while still passing 0 (NULL) to the underlying igraph C calls (since CALL: '0' is unchanged — the R-level callback values are received but not forwarded to C).

Testing

  • Package compiles without LTO type mismatch warnings
  • All 7994 tests pass

…_astar

Update ARPACKFUNC and ASTAR_HEURISTIC_FUNC in types-RC.yaml to use
HEADER: '%I%' instead of HEADER: {}, so the Stimulus-generated C
functions include these SEXP parameters in their signatures. This
fixes the LTO type mismatch warnings because cpp11.cpp (derived from
R call counts) and rinterface.c (from Stimulus) now agree on the
number of parameters for R_igraph_eigen_matrix,
R_igraph_eigen_matrix_symmetric, and R_igraph_get_shortest_path_astar.

Agent-Logs-Url: https://github.com/igraph/rigraph/sessions/83d94f5a-fc61-4e0f-bd60-8a2ff9c52c2d

Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
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