Repository navigation
Description
Summary
In C, a call through a struct member, a table entry or a callback argument names a function only at runtime. The engine records the member name as a call (for example do_recv), and that name does not match any repository definition, so the row lands in fcall_external and no edge reaches the function that the table really holds. In the curl scan, the member-call names that have a definition elsewhere in the repo are recorded as external, not linked. This is consistent with lower-bound PageRank, fan-in, and blast-radius numbers for C, but this issue is a hypothesis. Nobody has hand-checked a sample of dispatch call sites against the graph. Acceptance step 1 does that check before any fix is designed.
Note on the root cause: the code reading below explains why such edges are missing, but the mechanism has not been confirmed by a fix or a sample. Do not treat it as settled.
Class: indirect-call resolution gaps
The class is "a call whose callee is named only through a value at runtime". Members differ in syntax but share one question: does the resolver connect the caller to the implementation the value points to?
| form | example | status | evidence |
|---|---|---|---|
| struct-member function pointer, member access | cf->next->cft->do_recv(cf->next, data, buf, len, pnread) |
not resolved (name recorded, no edge to implementations) | lib/cfilters.h:221 (struct Curl_cftype, 14 function-pointer members); 87 cft->name( call lines in 21 files (study clone, HEAD 3dde2fb68); study DB: do_recv 8 external callers, 0 resolved edges; has_data_pending 16 / 0; query 28 / 0; do_send 8 / 0 |
| dispatch through a scheme table | conn->scheme->run->connect_it(data, protocol_done) |
not resolved | lib/multi.c:1956, lib/url.c:2244; struct Curl_protocol at lib/protocol.h:115, struct Curl_scheme at lib/protocol.h:250; study DB: connect_it 2 external, 0 resolved |
callback passed as an argument, or a table initializer { ..., cf_tcp_connect, ... } |
register_cb(foo);, static const struct Curl_cftype X = {..., foo, ...} |
not resolved | C reference edges are off (reference_edges is set only in languages/python.py:97 and languages/embedded_python.py:75; gitgalaxy/core/detector.py:9494 gates on it). The C call pattern is \b(ident)\s*\( (_shared_patterns.py:253), so a bare name with no ( produces no row. Read from code; not run on a C sample |
parenthesised deref call (*fp)(x) |
(*handler)(ctx) |
not resolved (no name captured for fp) |
same pattern: the name must be followed by (; in (*fp)(x) it is followed by ). Read from code; not run |
local or parameter function pointer called by name fp(x) |
cb(data) |
partial, unverified: recorded as a call to cb; links only if the repo defines a function cb (wrong link possible, not measured) |
CALLS_OUT_C_STYLE as above; gitgalaxy/core/call_resolver.py ladder (docs/function_call_graph.md, "How a call is linked") |
| macro-wrapped call, object-like redirect | #define xmalloc malloc |
partial: literal name counted, which allocator runs is invisible | docs/known_blind_spots.md:119 |
| macro-wrapped call, function-like alias | #define failf(...) Curl_failf(...) |
partial: #7828 (closed) fixed one alias case; coverage not re-measured here | docs/known_blind_spots.md:119-121; #7828 |
| C platform variants (same name defined per OS) | libuv uv__io_poll |
handled as variant candidates, not confident edges |
docs/function_call_graph.md, fcall_candidates (#8161) |
Python function values (key=sort_key, Depends(get_db)) |
handled (reference edges; 99.7% precision on 323 judged, fastapi) |
docs/function_call_graph.md:83, and the references row at ~line 117-118 |
|
| Java interface and virtual dispatch | x.save() on an interface |
ambiguous by design (receiver row, never an edge) |
docs/function_call_graph.md:62 |
Python getattr, dicts of callables |
out of reach, documented | docs/function_call_graph.md:139 |
|
| C++ virtual / function-object dispatch, Go and Rust function values | unverified in this issue | not measured here |
Why this matters for the C numbers: the libclang reference used to score C skips calls through a pointer: docs/graph_accuracy.md:268 ("A call through a function pointer names no function and is skipped"). So the C recall figures (tests/call_graph_resolution_c_baseline.json: recall_pct 50.8, resolution_recall_pct 55.3, libclang 18.1.1; the 66% for C in #8161 is a separate 20-repo run) cannot see these forms at all. The DOOM oracle also reports pointer references as function-pointer edges and does not score them (tests/tools/doom_speedrun/callgraph_oracle.py:419-424, doom_scorer.py:234; the convention was left open in #5874 and the kind is excluded by #6266). No existing gate measures recall on dispatch-table calls.
Sibling-language equivalents (to verify, not assumed): the same class in Go (function values in struct fields), Rust (Box<dyn Fn> fields), C++ (virtual calls through base pointers, function objects) and JavaScript (object-literal callbacks, def_shape: member, docs/function_call_graph.md). Mark each unverified until a sample is hand-checked.
Evidence in hand (curl, study clone at HEAD 3dde2fb68)
- The member-call names above are recorded as
fcall_externalcallers and have no resolved edges. - One name has both:
do_connect, 11 external member-call sites (cf->next->cft->do_connect(), and one resolved edgecf_tcp_connect -> do_connectinlib/cf-socket.cat stepfile. That edge is a genuine direct call in the same file. So in this sample the failure mode is missing edges, not wrong ones. No wrong link was observed among the sampled names. - The implementations that the tables hold (for example
cf_recvbuf_recvinlib/cf-recvbuf.c:52) are never linked from the call sites. Table initializers are not read as edges.
These are counts from the scan DB and reads of the source, not a measured recall. They do not show how many real calls are missed in total.
Acceptance
- Hand-checked sample (the first deliverable, no engine change). Pick 20 curl dispatch call sites (10
cft->form, 10->run->or other table form) and 10 table initializers. For each call site, read the table initializer that the pointer holds at that call (for example theCurl_cft_tcpfilter type), name the implementation, and check whether the graph links the caller to it. Record a table: form x (linked / external / absent / wrong). Post it on this issue. - Mechanism check. From the sample, state whether the missing edges come from (a) member-call names not matched to implementations, (b) table initializers not read as references, or (c) something else. A cause is "confirmed" only if the sample shows it.
- Recall gate blind spot. Record in
docs/graph_accuracy.md(C section, ~line 256) that the libclang gate does not score pointer calls, with the number from step 1. Do not change the gate in this issue. - Decide the design in a separate issue. Candidate mechanisms (a C reference kind for table initializers and callback arguments, a
fp(variable rule) need their own design and a measured precision. A new edge kind changes the graph and needs a golden re-bless with the drift attributed (CLAUDE.md, "Differential Scan"). - Wrong-link check. Any new rule must show wrong links are not added: a
fp(x)name that matches an unrelated repo function is the first case to test.
Discrepancies found while checking the study's claims
- The study's first summary named the protocol handler struct
struct Curl_handler, from memory of older curl versions, and that was wrong for the study clone. At 3dde2fb68 the tables arestruct Curl_protocol(lib/protocol.h:115) andstruct Curl_scheme(lib/protocol.h:250). The names depend on the commit being scanned. - The study's first C call-site row (total 31,925; external 12,521, 39%) came from a first curl scan that still included
tests/and the Python and Perl test harness. The later scans, with test, doc and vendored directories removed, give total 22,994, scoped 11,211, unique 2,067, ambiguous 36, external 9,680 (42%); the two test-free scans agree. Quote the test-free row, and say which directories were removed (see the tooling issue filed from the same study). - The study's first summary cited 13 multi-function call cycles in curl, from the same first scan that included
tests/. The test-free scan reports 11 (50 functions).
Remaining siblings (not filed here)
- The function-pointer edge convention for the DOOM oracle (open in DOOM-rosetta: score call-graph accuracy as a 7th clean-check (PERFECT = clean scan + call graph matches the oracle) #5874, closed;
function-pointerstill unscored by DOOM-rosetta check 7: get the 17 call-graph-failing ports to pass #6266). Needs an owner ruling before any change. - C platform variants and the rest of the C gap: Epic: call-graph recall to comparator quality across C, C++, Java, Go, Python, TS/JS, Rust (four PRs; edge kinds for open questions) #8161 (open epic; platform variants are 71% of C's gap per that epic). It does not name indirect calls, so this issue is a sibling, not a duplicate. The indirect-call share of the other 29% is unknown.
- Dynamic dispatch in Python and dicts of callables: documented as out of reach (
docs/function_call_graph.md:139); not a bug to fix here. - Declared-only macro calls and
#definealiasing:docs/known_blind_spots.md:119-121.
Labels and milestone
bug: the graph misses a class of edges the reference-free engine could resolve; no claim of a regression.call-graphis the area label (no description in the repo label list).core-enginefor the extractor and resolver.- Milestone "Compiler call-graph comparison" (chore(deps): bump actions/checkout from 4 to 6 #14), as the call-graph skills cite it.
Generated by Claude Code
Activity
squid-protocol commentedon Nov 22, 2026
Cross-links. These four issues came out of one study (fix history vs call-graph structure; 30 repositories in C, Go and Java). Read them together:
Order that makes sense: #8956 step 1 (hand-checked sample) tells us how far to trust the graph; #8957 and #8958 can land independently; #8955 should wait for the #8956 sample.
Generated by Claude Code
squid-protocol commentedon Nov 22, 2026
Acceptance #1 & #2: Hand-checked sample on
curl(01798a0)Scanned
curlat01798a0withgalaxyscope --db-only --offline(2,329files mapped) and checked 20 dispatch call sites (10cft->, 10->run->) and 10 table initializers (6Curl_cftype, 4Curl_protocol).20 Dispatch Call Sites
cft->lib/vtls/vtls.c:948ssl_cf_connectdo_connectin_cout=True,fcall_external(2 callers in file)cft->lib/vtls/vtls.c:1083ssl_cf_data_pendinghas_data_pendingin_cout=True,fcall_externalcft->lib/vtls/vtls.c:1233ssl_cf_queryqueryin_cout=True,fcall_externalcft->lib/vtls/openssl.c:1902ossl_shutdownis_alivein_cout=True,fcall_externalcft->lib/vtls/wolfssl.c:1912wssl_shutdownis_alivein_cout=True,fcall_externalcft->lib/vquic/cf-quiche.c:1598cf_quiche_queryqueryin_cout=True,fcall_externalcft->lib/vquic/cf-capsule.c:67cf_capsule_connectdo_connectin_cout=True,fcall_externalcft->lib/socks.c:1194socks_proxy_cf_connectdo_connectin_cout=True,fcall_externalcft->lib/http_proxy.c:477http_proxy_cf_connectdo_connectin_cout=True,fcall_externalcft->lib/http2.c:563http2_connisaliveis_alivein_cout=True,fcall_external->run->lib/url.c:499Curl_conn_freedisconnectin_cout=True,fcall_external->run->lib/url.c:1483setup_connection_internalssetup_connectionin_cout=True,fcall_external->run->lib/url.c:2244url_find_or_create_connconnect_itin_cout=True,fcall_external->run->lib/url.c:2264url_find_or_create_conndonein_cout=True,fcall_external->run->lib/transfer.c:720Curl_xfer_write_respwrite_respin_cout=True,fcall_external->run->lib/transfer.c:755Curl_xfer_write_resp_hdwrite_resp_hdin_cout=True,fcall_external->run->lib/multi.c:966Curl_attach_connectionattachin_cout=True,fcall_external->run->lib/multi.c:1817multi_dodo_itin_cout=True,fcall_external->run->lib/multi.c:1910protocol_connectingconnectingin_cout=True,fcall_external->run->lib/cshutdn.c:107cshutdn_run_conn_handlerdisconnectin_cout=True,fcall_externalSummary by form:
cft->(10)->run->(10)10 Table Initializers
fcall_dataincoming edge count across repo)Curl_cft_tcplib/cf-socket.c:1921cf_tcp_connect(0),cf_socket_send(0),cf_socket_recv(0),cf_socket_query(0)Curl_cft_udplib/cf-socket.c:2136cf_udp_connect(0),cf_socket_send(0),cf_socket_recv(0),cf_socket_query(0)Curl_cft_ssllib/vtls/vtls.c:1269ssl_cf_connect(1)*,ssl_cf_send(0),ssl_cf_recv(0),ssl_cf_query(0)Curl_cft_nghttp2lib/http2.c:2813cf_h2_connect(0),cf_h2_send(0),cf_h2_recv(0),cf_h2_is_alive(0)Curl_cft_http_proxylib/http_proxy.c:621http_proxy_cf_connect(0),cf_http_proxy_query(0)Curl_cft_socks_proxylib/socks.c:1312socks_proxy_cf_connect(0),socks_cf_query(0)Curl_protocol_tftplib/tftp.c:1343tftp_setup_connection(0),tftp_do(0),tftp_connect(1)*,tftp_done(0)Curl_protocol_smtplib/smtp.c:1996smtp_setup_connection(0),smtp_do(0),smtp_connect(0),smtp_disconnect(0)Curl_protocol_imaplib/imap.c:2310imap_setup_connection(0),imap_do(0),imap_connect(0),imap_disconnect(0)Curl_protocol_wslib/ws.c:2112ws_setup_conn(0),Curl_http(0),Curl_http_done(1)*,Curl_http_write_resp(0)*The 3 implementations within=1(ssl_cf_connect,tftp_connect,Curl_http_done) each have 1 direct call elsewhere, not from the table initializer; 0/10 initializers emit any edge and 33/36 sampled implementations havefunc_fan_in = 0.Confirmed Mechanism
Both (a) and (b) are confirmed:
calls_out_tounder its struct-member name (do_connect,query,connect_it,do_it, etc.), which matches no repo function definition and lands infcall_external(20/20 external, 0 wrong links).structtable initializers are not read as function references (reference_edgesis disabled for C andCALLS_OUT_C_STYLErequires(), so 0/10 tables link to their implementations.Opening a docs PR to record this libclang blind spot in
docs/graph_accuracy.md(Acceptance #3).docs(graph-accuracy): record C indirect/dispatch-table call blind spot (