Bug 31779 - mono-4.0.2 build failure on s390x
Summary: mono-4.0.2 build failure on s390x
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: 4.0.0
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-09 05:33 UTC by than
Modified: 2015-07-09 07:22 UTC (History)
2 users (show)

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


Attachments

Description than 2015-07-09 05:33:38 UTC
mono-4.0.2 doesnt build on s390x

[ERROR] FATAL UNHANDLED EXCEPTION: Mono.CSharp.InternalErrorException: ../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs(955,30): System.Linq.Expressions.Compiler.ILGen.EmitDecimal(this System.Reflection.Emit.ILGenerator, decimal) ---> Mono.CSharp.InternalErrorException: ../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs(955,78): ---> System.OverflowException: Overflow_Int32
  at System.Decimal.ToInt32 (Decimal d) [0x00000] in <filename unknown>:0 
  at System.Decimal.op_Explicit (Decimal value) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.DecimalConstant.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Arguments.Emit (Mono.CSharp.EmitContext ec, Boolean dup_args, Boolean prepareAwait) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.CallEmitter.EmitPredefined (Mono.CSharp.EmitContext ec, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Boolean statement, Nullable`1 loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.CallEmitter.Emit (Mono.CSharp.EmitContext ec, Mono.CSharp.MethodSpec method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.UserOperatorCall.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Expression.EmitBranchable (Mono.CSharp.EmitContext ec, Label target, Boolean on_true) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Binary.EmitBranchable (Mono.CSharp.EmitContext ec, Label target, Boolean on_true) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.If.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.If.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.If.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ParametersBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.TypeDefinition parent) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.MethodOrOperator.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.Method.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ClassOrStruct.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Class.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeDefinition.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.NamespaceContainer.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.TypeContainer.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.ModuleContainer.EmitContainer () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AssemblyDefinition.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.AssemblyDefinitionStatic.Emit () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 
../../build/library.make:270: recipe for target '../../class/lib/build/System.Core.dll' failed
Comment 1 than 2015-07-09 05:37:20 UTC
it looks like a bug in handling of lo64 on big endian systems. I attached the patch (backport from master branch) which fixes above build failure for me. 

diff -up mono-4.0.2/mono/metadata/decimal-ms.c.than mono-4.0.2/mono/metadata/decimal-ms.c
--- mono-4.0.2/mono/metadata/decimal-ms.c.than  2015-07-06 08:21:27.524461795 -0400
+++ mono-4.0.2/mono/metadata/decimal-ms.c       2015-07-06 08:30:26.954461795 -0400
@@ -55,8 +55,13 @@ static const uint32_t ten_to_ten_div_4 =
 #define DECIMAL_LO32(dec)        ((dec).v.v.Lo32)
 #define DECIMAL_MID32(dec)       ((dec).v.v.Mid32)
 #define DECIMAL_HI32(dec)        ((dec).Hi32)
-#define DECIMAL_LO64_GET(dec)    ((dec).v.Lo64)
-#define DECIMAL_LO64_SET(dec,value)   {(dec).v.Lo64 = value; }
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+# define DECIMAL_LO64_GET(dec)   (((uint64_t)((dec).v.v.Mid32) << 32) | (dec).v.v.Lo32)
+# define DECIMAL_LO64_SET(dec,value)   {(dec).v.v.Lo32 = (value); (dec).v.v.Mid32 = ((value) >> 32); }
+#else
+# define DECIMAL_LO64_GET(dec)    ((dec).v.Lo64)
+# define DECIMAL_LO64_SET(dec,value)   {(dec).v.Lo64 = value; }
+#endif
 
 #define DECIMAL_SETZERO(dec) {DECIMAL_LO32(dec) = 0; DECIMAL_MID32(dec) = 0; DECIMAL_HI32(dec) = 0; DECIMAL_SIGNSCALE(dec) = 0;}
 #define COPYDEC(dest, src) {DECIMAL_SIGNSCALE(dest) = DECIMAL_SIGNSCALE(src); DECIMAL_HI32(dest) = DECIMAL_HI32(src); \

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