Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Conversation

@yowl
Copy link
Contributor

@yowl yowl commented Aug 7, 2020

This PR fixes a compiler assert when compiling https://github.com/dotnet/corert/blob/master/src/System.Private.CoreLib/shared/System/Environment.Unix.cs#L111 as the char type was not included in the int32 path. Types short and byte seem ok before this change so no code added for those.

case ILOpcode.add_ovf:
Debug.Assert(type.Category == TypeFlags.Int32 || type.Category == TypeFlags.Int64);
if (type.Category == TypeFlags.Int32)
Debug.Assert(type.Category == TypeFlags.Int32 || type.Category == TypeFlags.Int64 || type.Category == TypeFlags.Char);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not sound right to have char on the IL stack. Should char be converted to int32 when it gets loaded onto the IL stack instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ILVerify does it in StackValue.CreateFromType method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Webassembly stack entries keep both the StackValueKind and the TypeDesc . I've changed these asserts and ifs to use thte StackValueKind which I think is more correct and inline with StackValue.CreateFromType

@jkotas
Copy link
Member

jkotas commented Aug 11, 2020

Thanks

@jkotas jkotas merged commit 127405d into dotnet:master Aug 11, 2020
@yowl yowl deleted the wasm-ovf-char branch August 11, 2020 12:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants