[ArkTS frontend] Incorrect test result with --opt-level=2
Test case produces different results for opt level 0 and 2:
let a = 12
let b = 11
let res = ""
function foo(): string {
res += "foo called"
return "Assert message"
}
function main(): int {
res = ""
try {
assert (a > b ? b == a : a < b) : foo() // foo must be called
} catch (e) {
// expected
}
return res == "" ? 1 : 0
}
output with --opt-level=0, correct result, exit code = 0:
bin/es2panda --arktsconfig=tools/es2panda/generated/arktsconfig.json --log-level=error --thread=0 --opt-level=0 --extension=ets --gen-stdlib=false --output=/tmp/assert_8.abc /home/vkopyl/ohos_root/arkcompiler/runtime_core/static_core/plugins/ets/tests/output/gen/17.experimental_features/05.statements/03.assert_statement/assert_8.ets 2>&1
bin/verifier --boot-panda-files=plugins/ets/etsstdlib.abc --load-runtimes=ets --config-file=/home/vkopyl/ohos_root/arkcompiler/runtime_core/static_core/tests/tests-u-runner/runner/plugins/ets/ets-verifier.config /tmp/assert_8.abc 2>&1
bin/ark --boot-panda-files=plugins/ets/etsstdlib.abc --interpreter-type=cpp --load-runtimes=ets --compiler-enable-jit=true --compiler-check-final=true --gc-type=g1-gc --heap-verifier=fail_on_verification:pre:into:before_g1_concurrent:post --full-gc-bombing-frequency=0 /tmp/assert_8.abc ETSGLOBAL::main; echo __$?__
Assert message
__0__
output with --opt-level=2, incorrect result, exit code = 1:
bin/es2panda --arktsconfig=tools/es2panda/generated/arktsconfig.json --log-level=error --thread=0 --opt-level=2 --extension=ets --gen-stdlib=false --output=/tmp/assert_8.abc /home/vkopyl/ohos_root/arkcompiler/runtime_core/static_core/plugins/ets/tests/output/gen/17.experimental_features/05.statements/03.assert_statement/assert_8.ets 2>&1
bin/verifier --boot-panda-files=plugins/ets/etsstdlib.abc --load-runtimes=ets --config-file=/home/vkopyl/ohos_root/arkcompiler/runtime_core/static_core/tests/tests-u-runner/runner/plugins/ets/ets-verifier.config /tmp/assert_8.abc 2>&1
bin/ark --boot-panda-files=plugins/ets/etsstdlib.abc --interpreter-type=cpp --load-runtimes=ets --compiler-enable-jit=true --compiler-check-final=true --gc-type=g1-gc --heap-verifier=fail_on_verification:pre:into:before_g1_concurrent:post --full-gc-bombing-frequency=0 /tmp/assert_8.abc ETSGLOBAL::main; echo __$?__
Assert message
__1__
The correct result is $?==0
It should be produced for both opt_level=0
and opt_level=2
see above
感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 @godmiaozi @peijiajun @Ishin Pavel @Vyacheslav Cherkashin 。如果需要调整订阅PR、Issue的变更状态,请访问链接。
Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer @godmiaozi @peijiajun @Ishin Pavel @Vyacheslav Cherkashin for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Closed because of the OHOS release
登录 后才可以发表评论