You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Second (or later) init() or _() gets no L3 or L4 output #76
Describe the bug
Again on PR #55, related to #75. We store the second func init() in a file under the signature <pkg>.init:2. Now, L3 and L4 stages do their look ups by declaration with (file, SignatureOf(obj)). This will give us <pkg>.init for every init. The look up for init will always give us init (the first one) regardless of how many inits there actually are. But when this happens, the start line of the actual init and what we got do not match and the analyzer skips this entirely.
The second init then has no cfg, cdg, ddg or L4 vertices. Its body has no @entry and no @exit. Nothing goes into degraded[], and --strict does not fail.
To Reproduce
Steps to reproduce:
Use the two-init project from the closure issue (one main.go, two func init(), each with a closure).
Run cango -i . -a 3 -o out.
Look at main.go/init:2 in out/analysis.json.
Expected behavior init:2 has the same L3 facts as init: @entry, @exit and a cfg. If L3 cannot be built, an entry in degraded[] names it.
main.go/init lines 5-8 cfg 4 body {6:2, 7:2, @entry, @exit}
main.go/init:2 lines 10-13 cfg 0 body {12:2}
degraded: none
Additional context
L3: internal/syntactic_analysis/l3units.go:70. The key uses b.declSignature(pkg, fd), which has no :N. byKey has init and init:2, so the second FuncDecl matches the first init, fails the StartLine check and is skipped with no warning.
L4: internal/sdg/join.go:244 (declKey) has the same mismatch, so the SSA function of the second init does not join to a unit.
Possible fix: one helper that maps a FuncDecl to its symbol-table signature (with the :N), used by the symbol table, L3Units and declKey. Alternatively, key these maps by declaration position.
changed the title [-]Second (or later) `init()` gets no L3 or L4 output[/-][+]Second (or later) `init()` or `_()` gets no L3 or L4 output[/+]on Nov 29, 2026
Activity
[-]Second (or later) `init()` gets no L3 or L4 output[/-][+]Second (or later) `init()` or `_()` gets no L3 or L4 output[/+]fix(symbol-table): give a repeated init or _ its suffix before its cl…