-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix a compiler crash with
.varargs
proc types (#1396)
## Summary Fix the compiler crashing when a non-closure `proc` type with C-style varargs is used somewhere. Only the C backend was affected. Fixes #1394. ## Details * `mirtypes.callConv` didn't consider the `x` field storing a boolean value in the most-significant bit, resulting in range defect * the integer value is now properly masked before converting it to a `TCallingConvention` enum value
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
discard """ | ||
description: ''' | ||
Regression test for a bug with querying the calling convention of a MIR | ||
type. Derived from https://github.com/nim-works/nimskull/issues/1394. | ||
''' | ||
""" | ||
|
||
# calling convention doesn't matter, as long as the proc type is not a closure | ||
# type | ||
var p: proc(x: int) {.nimcall, varargs.} |