Bug 52735 - Mono too aggressively optimized code. Skip convert
Summary: Mono too aggressively optimized code. Skip convert
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-24 10:51 UTC by Sergei
Modified: 2017-03-02 00:47 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
generated il code (2.82 KB, text/plain)
2017-02-24 10:51 UTC, Sergei
Details

Description Sergei 2017-02-24 10:51:03 UTC
Created attachment 19941 [details]
generated il code

Part of il(emit) generated code attached.
The defect appears only in release mode(if start .exe with '--debug=mdb-optimizations', app will be work correctly).
 
this code throw exception with message: " Error feeding module: Field "xxx.TradeMessage.aggressorSide", bound to xxx.Messages.AggressorSide (underliing type is System.Int32), cannot contain unsupported value 255 of enum xxx.Messages.AggressorSide. This value is out of supported range."

can see(from attached il src) exception mean that 'AggressorSide_6' local variable has '255' value. but 'AggressorSide_6' local variable was assigned with SByte value[-128;127].

method ReadEnumInt8() from which was taken SByte can be represented as (with simplifications):

SByte ReadEnumInt8()
{
   ...
   return (SByte)byteArray[i]; //where byteArray is byte[]
}

It looks like mono skip Byte to SByte convertion.

Note You need to log in before you can comment on or make changes to this bug.