WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.3% of users enabled 2FA.

Commit 30023153 authored by qinsoon's avatar qinsoon
Browse files

added two more tests that try to reproduce a reported bug, but the bug

seems to be fixed before.
parent 39a526ef
......@@ -639,4 +639,14 @@ macro_rules! inst {
v: Instruction_::SetRetval(0)
(($vm: expr, $fv: ident) $name: ident: MOVE $src: ident -> $dst: ident) => {
let $name = $fv.new_inst(Instruction {
hdr: MuEntityHeader::unnamed($vm.next_id()),
value: Some(vec![$dst.clone_value()]),
ops: vec![$src],
v: Instruction_::Move(0)
......@@ -29,3 +29,4 @@ mod test_mem_inst;
mod test_inline;
mod test_convop;
mod test_int128;
mod test_misc;
\ No newline at end of file
extern crate mu;
extern crate log;
extern crate libloading;
use self::mu::ast::types::*;
use self::mu::ast::ir::*;
use self::mu::ast::inst::*;
use self::mu::vm::*;
use self::mu::linkutils;
use self::mu::utils::LinkedHashMap;
fn test_mov_minus_one_to_int8() {
let lib = linkutils::aot::compile_fnc("mov_minus_one_to_int8", &mov_minus_one_to_int8);
unsafe {
let mov_minus_one_to_int8: libloading::Symbol<unsafe extern "C" fn() -> (i8)> =
let res = mov_minus_one_to_int8();
println!("mov_minus_one_to_u8() = {}", res);
assert!(res == -1);
fn mov_minus_one_to_int8() -> VM {
let vm = VM::new();
typedef! ((vm) int8 = mu_int(8));
constdef! ((vm) <int8> int8_minus_one = Constant::Int(-1i8 as u64));
funcsig! ((vm) mov_minus_one_to_int8_sig = () -> (int8));
funcdecl! ((vm) <mov_minus_one_to_int8_sig> mov_minus_one_to_int8);
funcdef! ((vm) <mov_minus_one_to_int8_sig> mov_minus_one_to_int8
VERSION mov_minus_one_to_int8_v1);
block! ((vm, mov_minus_one_to_int8_v1) blk_entry);
consta! ((vm, mov_minus_one_to_int8_v1) int8_minus_one_local = int8_minus_one);
ssa! ((vm, mov_minus_one_to_int8_v1) <int8> ret);
inst! ((vm, mov_minus_one_to_int8_v1) blk_entry_mov:
MOVE int8_minus_one_local -> ret
inst! ((vm, mov_minus_one_to_int8_v1) blk_entry_ret:
RET (ret)
define_block!((vm, mov_minus_one_to_int8_v1) blk_entry() {
define_func_ver!((vm) mov_minus_one_to_int8_v1 (entry: blk_entry) {
fn test_branch_minus_one_to_int8() {
let lib = linkutils::aot::compile_fnc("branch_minus_one_to_int8", &branch_minus_one_to_int8);
unsafe {
let branch_minus_one_to_int8: libloading::Symbol<unsafe extern "C" fn() -> (i8)> =
let res = branch_minus_one_to_int8();
println!("branch_minus_one_to_u8() = {}", res);
assert!(res == -1);
fn branch_minus_one_to_int8() -> VM {
let vm = VM::new();
typedef! ((vm) int8 = mu_int(8));
constdef! ((vm) <int8> int8_minus_one = Constant::Int(-1i8 as u64));
funcsig! ((vm) branch_minus_one_to_int8_sig = () -> (int8));
funcdecl! ((vm) <branch_minus_one_to_int8_sig> branch_minus_one_to_int8);
funcdef! ((vm) <branch_minus_one_to_int8_sig> branch_minus_one_to_int8
VERSION branch_minus_one_to_int8_v1);
// blk_entry
block! ((vm, branch_minus_one_to_int8_v1) blk_entry);
block! ((vm, branch_minus_one_to_int8_v1) blk_ret);
consta! ((vm, branch_minus_one_to_int8_v1) int8_minus_one_local = int8_minus_one);
inst! ((vm, branch_minus_one_to_int8_v1) blk_entry_branch:
BRANCH blk_ret (int8_minus_one_local)
define_block!((vm, branch_minus_one_to_int8_v1) blk_entry() {
// blk_ret
ssa! ((vm, branch_minus_one_to_int8_v1) <int8> res);
inst! ((vm, branch_minus_one_to_int8_v1) blk_ret_ret:
RET (res)
define_block!((vm, branch_minus_one_to_int8_v1) blk_ret(res) {
define_func_ver!((vm) branch_minus_one_to_int8_v1 (entry: blk_entry) {
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