Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix a compiler crash with .varargs proc types #1396

Merged

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Aug 4, 2024

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

Summary
=======

Fix the compiler crashing when a non-closure `proc` type with C-style
varargs is used somewhere. Only the C backend was affected.

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
@zerbina zerbina added bug Something isn't working compiler/backend Related to backend system of the compiler labels Aug 4, 2024
@zerbina zerbina added this to the MIR phase milestone Aug 4, 2024
@saem
Copy link
Collaborator

saem commented Aug 4, 2024

/merge

Copy link

github-actions bot commented Aug 4, 2024

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


Notes for Reviewers

  • this is a case where built-in integers types like uint1 and uint31 would be useful

@chore-runner chore-runner bot enabled auto-merge August 4, 2024 00:53
@chore-runner chore-runner bot added this pull request to the merge queue Aug 4, 2024
Merged via the queue into nim-works:devel with commit ec713a1 Aug 4, 2024
31 checks passed
@zerbina zerbina deleted the fix-cgen-proc-type-regression branch August 13, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler/backend Related to backend system of the compiler
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Compiler crash with new mangling module with a cdecl,varargs proc
2 participants