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

Boolean-integer type compatibility. #65

Closed
michael-emmi opened this issue Apr 29, 2019 · 1 comment
Closed

Boolean-integer type compatibility. #65

michael-emmi opened this issue Apr 29, 2019 · 1 comment

Comments

@michael-emmi
Copy link
Collaborator

michael-emmi commented Apr 29, 2019

This assertion fails on the following program:

.class TestExceptionsWhen {
  .method void Main () cil managed {
	.locals init (bool)
	  ldc.i4.1 
	  stloc.0 
	  ldloc.0 
	  ldc.i4.0
	  cgt.un 
	  ret 
  }
}

The issue is that the arguments to the greater-than operation (cgt.un) are given incompatible Boogie types (int and bool) — the bool is due to the store and subsequent load to Boolean-typed local variable 0. In fact, this is valid CIL code (e.g., according to ECMA-335), since Boolean values are loaded onto the stack as zero-extended int32s. As far as I can tell, there are no relevant type-conversion operations here.

As far as context goes, this is a minimization of the code generated for the TestExceptionsWhen test on Mono, which is trips the assertion. I suppose that different code is being generated on Windows (?).

This code is based on code generated with this compiler:

$ csc 
Microsoft (R) Visual C# Compiler version 2.8.2.62916 (2ad4aabc)
Copyright (C) Microsoft Corporation. All rights reserved.
@michael-emmi
Copy link
Collaborator Author

This duplicates edgardozoppi/analysis-net#10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant