Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deepvm 控制流在 64 位下的问题 #51

Open
HobbitQia opened this issue Aug 5, 2023 · 0 comments
Open

deepvm 控制流在 64 位下的问题 #51

HobbitQia opened this issue Aug 5, 2023 · 0 comments

Comments

@HobbitQia
Copy link

在编写 deepvn 控制流测试用例时发现了一个小问题,如下面的测试用例(对应的 wasm 代码为 test/control/loop/for_64_1.wasm)

long long ADD(long long a, long long b) {
  return a+b;
}
int main (void) {
    long long i, res = 0;
    for (i = 0; i < 10; i++) 
        res = ADD(res, i);
    return res;
}

这里的输出应该是 45,但是测试得到的返回值为 0。同理 test/control/loop,test/control/break 下的所有 32 位的测试用例改为 64 位后都不对,而且返回值始终为 0。

还有一个问题是在 switch case 中,

long long getVal (long long a, long long b) {
  long long res = (a + 1) * b;
  return res;
}
int main (void) {
  long long res = 0;
  long long cond = getVal(4, 10);
  switch (cond) {
    case 10:
      res = 11;
      break;
    case 20:
      res = 22;
      break;
    case 30:
      res = 33;
      break;
    case 40:
      res = 44;
      break;
    case 50:
      res = 55;
      break;
    case 60:
       res = 66;
       break;
    case 70:
       res = 77;
       break;
    default:
       res = -1;
  }
  return res;
}

这里的返回值应该是 55,但得到的返回值却是 11。(可见 test/control/switch/switch_case_64_1.wasm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant