Unverified Commit 2609f0a2 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5139 from shuujii/avoid-undefined-behavior

Avoid undefined behavior
parents 5156ea99 7c470e25
...@@ -170,7 +170,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep) ...@@ -170,7 +170,7 @@ codedump(mrb_state *mrb, const mrb_irep *irep)
print_lv_a(mrb, irep, a); print_lv_a(mrb, irep, a);
break; break;
CASE(OP_LOADI32, BSS); CASE(OP_LOADI32, BSS);
printf("OP_LOADI32\tR%d\t%d\t", a, (int)(b<<16)+c); printf("OP_LOADI32\tR%d\t%d\t", a, (int)(((uint32_t)b<<16)+c));
print_lv_a(mrb, irep, a); print_lv_a(mrb, irep, a);
break; break;
CASE(OP_LOADI__1, B); CASE(OP_LOADI__1, B);
......
...@@ -1069,7 +1069,7 @@ RETRY_TRY_BLOCK: ...@@ -1069,7 +1069,7 @@ RETRY_TRY_BLOCK:
NEXT; NEXT;
} }
CASE(OP_LOADL16, BS) { CASE(OP_LOADL16, BS) {
goto op_loadl; goto op_loadl;
} }
...@@ -1135,7 +1135,7 @@ RETRY_TRY_BLOCK: ...@@ -1135,7 +1135,7 @@ RETRY_TRY_BLOCK:
} }
CASE(OP_LOADI32, BSS) { CASE(OP_LOADI32, BSS) {
SET_INT_VALUE(mrb, regs[a], ((mrb_int)b<<16)+c); SET_INT_VALUE(mrb, regs[a], (mrb_int)(((uint32_t)b<<16)+c));
NEXT; NEXT;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment