[interp] throw overflow exception on long to ulong cast where long is negative
[mono.git] / mono / mini / alias-analysis.c
index c419dfa2b42abf4139037e97340225628b8670b3..7ff437f9f9d5e9e1585cc4ac2d9a890959ed0b41 100644 (file)
@@ -159,10 +159,17 @@ lower_memory_access (MonoCompile *cfg)
                for (ins = bb->code; ins; ins = ins->next) {
 handle_instruction:
                        switch (ins->opcode) {
-                       case OP_LDADDR:
-                               g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins);
-                               if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); }
+                       case OP_LDADDR: {
+                               MonoInst *var = (MonoInst*)ins->inst_p0;
+                               if (var->flags & MONO_INST_VOLATILE) {
+                                       if (cfg->verbose_level > 2) { printf ("Found address to volatile var, can't take it: "); mono_print_ins (ins); }
+                               } else {
+                                       g_hash_table_insert (addr_loads, GINT_TO_POINTER (ins->dreg), ins);
+                                       if (cfg->verbose_level > 2) { printf ("New address: "); mono_print_ins (ins); }
+                               }
                                break;
+                       }
+
                        case OP_MOVE:
                                tmp = (MonoInst*)g_hash_table_lookup (addr_loads, GINT_TO_POINTER (ins->sreg1));
                                /*