Merge pull request #1101 from jariq/master
authorAlex Rønne Petersen <alex@lycus.org>
Mon, 16 Jun 2014 12:54:30 +0000 (14:54 +0200)
committerAlex Rønne Petersen <alex@lycus.org>
Mon, 16 Jun 2014 12:54:30 +0000 (14:54 +0200)
Support both unencrypted PKCS#12 and PKCS#12 encrypted with an empty pas...

12 files changed:
acinclude.m4
eglib/acinclude.m4
libgc/acinclude.m4
mcs/class/System.Data/Mono.Data.SqlExpressions/Tokenizer.cs
mcs/class/corlib/System/DateTime.cs
mcs/class/corlib/Test/System/DateTimeTest.cs
mcs/mcs/expression.cs
mcs/mcs/statement.cs
mcs/tests/test-896.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_5.xml
mono/mini/mini-arm.h
mono/mini/mini-x86.c

index 16fecf7f8608938102a35d90aadc6319ada10d17..5216cd14a5ef88245107fe9f27c1821914e14025 100644 (file)
@@ -22,7 +22,7 @@ if test x$GCC != xyes; then
     dolt_supported=no
 fi
 case $host in
-i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
+i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
 |amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
     pic_options='-fPIC'
     ;;
@@ -158,7 +158,7 @@ modeok=false
 tagok=false
 for arg in "$[]@"; do
     case "$arg" in
-        --silent) ;;    
+        --silent) ;;
         --mode=compile) modeok=true ;;
         --tag=CC|--tag=CXX) tagok=true ;;
         --quiet) ;;
index 526d00c1be7822b1cfa9de6a821dd5c7ed0795e8..5216cd14a5ef88245107fe9f27c1821914e14025 100644 (file)
@@ -22,8 +22,8 @@ if test x$GCC != xyes; then
     dolt_supported=no
 fi
 case $host in
-i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
-|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*)
+i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
+|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
     pic_options='-fPIC'
     ;;
 ?86-pc-cygwin*|i?86-pc-cygwin*)
index 526d00c1be7822b1cfa9de6a821dd5c7ed0795e8..5216cd14a5ef88245107fe9f27c1821914e14025 100644 (file)
@@ -22,8 +22,8 @@ if test x$GCC != xyes; then
     dolt_supported=no
 fi
 case $host in
-i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
-|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*)
+i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
+|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
     pic_options='-fPIC'
     ;;
 ?86-pc-cygwin*|i?86-pc-cygwin*)
index 3208718e7da3d2f2f594d725979c5527cbd750f5..256da0cfa142545c2a0d0605ba51a6284d2342c1 100644 (file)
@@ -136,10 +136,10 @@ namespace Mono.Data.SqlExpressions {
 
                        string str = sb.ToString ();
 
-                       if (str.IndexOf(".") == -1)
-                               return Int64.Parse (str);
-                       else
-                               return double.Parse (str);
+                       if (str.IndexOf ('.') < 0)
+                               return Int64.Parse (str, CultureInfo.InvariantCulture);
+
+                       return double.Parse (str, CultureInfo.InvariantCulture);
                }
 
                private char ProcessEscapes(char c)
@@ -327,7 +327,7 @@ namespace Mono.Data.SqlExpressions {
 
                        case '#':
                                string date = ReadString ('#');
-                               val = DateTime.Parse (date);
+                               val = DateTime.Parse (date, CultureInfo.InvariantCulture);
                                return Token.DateLiteral;
 
                        case '\'':
index c3da055efc02589a97da57a0fc3d9f8d0ca52e81..30bc6f8edf82b05deb1da4e8a2ebc8a2cacd389c 100644 (file)
@@ -214,6 +214,10 @@ namespace System
                        "yyyy/MMMM",
                };
 
+               private static readonly string[] ExoticAndNonStandardFormats = new string[] {
+                       "ddMMMyyyy"
+               };
+
                private enum Which 
                {
                        Day,
@@ -927,6 +931,9 @@ namespace System
                        if (ParseExact (s, dfi.GetAllDateTimePatternsInternal (), dfi, styles, out result, false, ref longYear, setExceptionOnError, ref exception))
                                return true;
 
+                       if (ParseExact (s, ExoticAndNonStandardFormats, dfi, styles, out result, false, ref longYear, setExceptionOnError, ref exception))
+                               return true;
+
                        if (!setExceptionOnError)
                                return false;
                        
index 0e7b294f3b9495c29fef8db2a6b71faf1be62475..343e723be82e8b6ce8bf0145a4e4a57c93a78482 100644 (file)
@@ -1216,6 +1216,15 @@ namespace MonoTests.System
                        DateTime.Parse ("Sat,,, 01,,, Oct,,, ,,,1994 03:00:00", CultureInfo.InvariantCulture);
                }
 
+               [Test]
+               public void TryParse_Bug11630 ()
+               {
+                       DateTime parsed;
+
+                       Assert.IsTrue (DateTime.TryParse ("10Feb2013", out parsed));
+                       Assert.AreEqual (new DateTime (2013, 2, 10), parsed);
+               }
+
                [Test]
                [ExpectedException (typeof (FormatException))]
                public void Parse_CommaAfterHours ()
index 96431ffa39346999acf7849dacb03ab2c91435bb..caaab3404dd71576f49944697465b87c8788164f 100644 (file)
@@ -11066,7 +11066,7 @@ namespace Mono.CSharp
 
                public override void Emit (EmitContext ec)
                {
-                       if (method == null && TypeSpec.IsValueType (type) && initializers.Initializers.Count > 1 && initializers.ContainsEmitWithAwait ()) {
+                       if (method == null && TypeSpec.IsValueType (type) && initializers.Initializers.Count > 1 && ec.HasSet (BuilderContext.Options.AsyncBody) && initializers.ContainsEmitWithAwait ()) {
                                var fe = ec.GetTemporaryField (type);
 
                                if (!Emit (ec, fe))
index ced42136ea55b696914b03b723aca60c8fae31de..a09c4acd939b99b5262234bdac40c46019aa09ce 100644 (file)
@@ -2186,13 +2186,13 @@ namespace Mono.CSharp {
                {
                        li.CreateBuilder (ec);
 
-                       if (Initializer != null)
+                       if (Initializer != null && !IsUnreachable)
                                ((ExpressionStatement) Initializer).EmitStatement (ec);
 
                        if (declarators != null) {
                                foreach (var d in declarators) {
                                        d.Variable.CreateBuilder (ec);
-                                       if (d.Initializer != null) {
+                                       if (d.Initializer != null && !IsUnreachable) {
                                                ec.Mark (d.Variable.Location);
                                                ((ExpressionStatement) d.Initializer).EmitStatement (ec);
                                        }
@@ -2925,7 +2925,7 @@ namespace Mono.CSharp {
 
                                end_unreachable = s.FlowAnalysis (fc);
                                if (s.IsUnreachable) {
-                                       statements[startIndex] = new EmptyStatement (s.loc);
+                                       statements [startIndex] = RewriteUnreachableStatement (s);
                                        continue;
                                }
 
@@ -2952,7 +2952,7 @@ namespace Mono.CSharp {
 
                                                if (s.IsUnreachable) {
                                                        s.FlowAnalysis (fc);
-                                                       statements[startIndex] = new EmptyStatement (s.loc);
+                                                       statements [startIndex] = RewriteUnreachableStatement (s);
                                                }
                                        }
                                }
@@ -2967,6 +2967,24 @@ namespace Mono.CSharp {
                        return !Explicit.HasReachableClosingBrace;
                }
 
+               static Statement RewriteUnreachableStatement (Statement s)
+               {
+                       // LAMESPEC: It's not clear whether declararion statement should be part of reachability
+                       // analysis. Even csc report unreachable warning for it but it's actually used hence
+                       // we try to emulate this behaviour
+                       //
+                       // Consider:
+                       //      goto L;
+                       //      int v;
+                       // L:
+                       //      v = 1;
+
+                       if (s is BlockVariable)
+                               return s;
+
+                       return new EmptyStatement (s.loc);
+               }
+
                public void ScanGotoJump (Statement label)
                {
                        int i;
@@ -6938,6 +6956,7 @@ namespace Mono.CSharp {
                        public VariableDeclaration (LocalVariable li, Location loc)
                                : base (li)
                        {
+                               reachable = true;
                                this.loc = loc;
                        }
 
@@ -7380,6 +7399,7 @@ namespace Mono.CSharp {
                                public RuntimeDispose (LocalVariable lv, Location loc)
                                        : base (lv, loc)
                                {
+                                       reachable = true;
                                }
 
                                protected override void CheckIDiposableConversion (BlockContext bc, LocalVariable li, Expression initializer)
diff --git a/mcs/tests/test-896.cs b/mcs/tests/test-896.cs
new file mode 100644 (file)
index 0000000..4336bf7
--- /dev/null
@@ -0,0 +1,13 @@
+using System;
+
+class Program
+{
+       public static void Main ()
+       {
+               goto L1;
+               int z;
+       L1: 
+               z = 3;
+               Console.WriteLine (z);
+       }
+}
\ No newline at end of file
index b9acb70491d8302d92be4ee585cad93374423884..97366458344bab69fb156aa464139cdb0f3a0b16 100644 (file)
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-896.cs">\r
+    <type name="Program">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>15</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-9.cs">\r
     <type name="X">\r
       <method name="Int32 Main(System.String[])" attrs="150">\r
index cba8a33a7442ad1adfd34e8a9221d25fcc4803d5..131d43300166f748532ccb0c60dd987131906671 100644 (file)
  * reproduceable results for benchmarks */
 #define MONO_ARCH_CODE_ALIGNMENT 32
 
+/* Argument marshallings for calls between gsharedvt and normal code */
+typedef enum {
+       GSHAREDVT_ARG_NONE = 0,
+       GSHAREDVT_ARG_BYVAL_TO_BYREF = 1,
+       GSHAREDVT_ARG_BYREF_TO_BYVAL = 2,
+       GSHAREDVT_ARG_BYREF_TO_BYVAL_I1 = 3,
+       GSHAREDVT_ARG_BYREF_TO_BYVAL_I2 = 4,
+       GSHAREDVT_ARG_BYREF_TO_BYVAL_U1 = 5,
+       GSHAREDVT_ARG_BYREF_TO_BYVAL_U2 = 6
+} GSharedVtArgMarshal;
+
 /* Return value marshalling for calls between gsharedvt and normal code */
 typedef enum {
        GSHAREDVT_RET_NONE = 0,
index 8a95cabcb5cc8a816ee842489691494cb528771f..3de9b0be1a226801938979a57a19bb9a0c8bae13 100644 (file)
@@ -2300,9 +2300,10 @@ mono_emit_stack_alloc (MonoCompile *cfg, guchar *code, MonoInst* tree)
                        x86_push_reg (code, X86_EDI);
                        x86_mov_reg_imm (code, X86_ECX, (0x1000 >> 2));
                        x86_alu_reg_reg (code, X86_XOR, X86_EAX, X86_EAX);                              
-                       x86_lea_membase (code, X86_EDI, X86_ESP, 12);
                        if (cfg->param_area && cfg->arch.no_pushes)
-                               x86_alu_reg_imm (code, X86_ADD, X86_EDI, cfg->param_area);
+                               x86_lea_membase (code, X86_EDI, X86_ESP, 12 + ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT));
+                       else
+                               x86_lea_membase (code, X86_EDI, X86_ESP, 12);
                        x86_cld (code);
                        x86_prefix (code, X86_REP_PREFIX);
                        x86_stosl (code);
@@ -2349,7 +2350,10 @@ mono_emit_stack_alloc (MonoCompile *cfg, guchar *code, MonoInst* tree)
                        x86_mov_reg_reg (code, X86_ECX, sreg, 4);
                x86_alu_reg_reg (code, X86_XOR, X86_EAX, X86_EAX);
                                
-               x86_lea_membase (code, X86_EDI, X86_ESP, offset);
+               if (cfg->param_area && cfg->arch.no_pushes)
+                       x86_lea_membase (code, X86_EDI, X86_ESP, offset + ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT));
+               else
+                       x86_lea_membase (code, X86_EDI, X86_ESP, offset);
                x86_cld (code);
                x86_prefix (code, X86_REP_PREFIX);
                x86_stosl (code);
@@ -3456,7 +3460,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        code = mono_emit_stack_alloc (cfg, code, ins);
                        x86_mov_reg_reg (code, ins->dreg, X86_ESP, 4);
                         if (cfg->param_area && cfg->arch.no_pushes)
-                                x86_alu_reg_imm (code, X86_ADD, ins->dreg, cfg->param_area);
+                                x86_alu_reg_imm (code, X86_ADD, ins->dreg, ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT));
                        break;
                case OP_LOCALLOC_IMM: {
                        guint32 size = ins->inst_imm;
@@ -3474,7 +3478,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                x86_mov_reg_reg (code, ins->dreg, X86_ESP, 4);
                        }
                         if (cfg->param_area && cfg->arch.no_pushes)
-                                x86_alu_reg_imm (code, X86_ADD, ins->dreg, cfg->param_area);
+                                x86_alu_reg_imm (code, X86_ADD, ins->dreg, ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT));
                        break;
                }
                case OP_THROW: {