Repository navigation
bugc: compile a void function call as a statement - #351
Merged
Merged
Conversation
gnidan
added a commit
that referenced
this pull request
Oct 7, 2026
Contributor
|
irgen converted a call's type to an IR type before it checked for a void function, whose call type is the type checker's "void function" failure, so fromBugType threw. Check first and convert only a call with a result.
gnidan
force-pushed
the
bugc-void-call-statement
branch
from
October 7, 2026 00:57
5532adc to
9cc00a3
Compare
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.
A call to a function with no return type, as a statement (
bump();), failed in IR generation with "Cannot convert type with kind fail to IR type". The type checker gives such a call the typefailure("void function"), andbuildCallpassed that type tofromBugTypebefore it checked whether the function is void. It now checks first, and converts the type only for a call with a result.Nothing past IR generation needed a change: the call terminator already has an optional
dest, and since #349 the exitJUMP'sreturncontext leaves outdatawhen the function returns no value.Tests:
behavioral.test.ts: void calls at O0–O3 (a plain call, arguments with an earlyreturn;, calls in a loop, a void function calling another, a local live across a void call).call-contexts.test.ts: the caller'sJUMPhas theinvoke, and the callee's exitJUMPhas areturnwith nodata.call-timing.test.ts: a void case, so a void callee's frame is on from its entryJUMPDESTthrough its exitJUMP, at O0–O3. A void exit recordsundefinedin place of a read value.local-variables.soundness.test.ts: a void call with a parameter, a callee local, and a caller local live across the call.