已关闭
[Bug]: Crash when static ETS imports dynamic enum #11954
ajq257257创建于  8月18日关闭于  8月24日
ajq257257
8月18日 创建

感谢对OpenHarmony社区的支持与关注,欢迎反馈缺陷。

发生了什么问题?

ArkCompiler converts .ets source to ARK bytecode (.abc). The es2panda frontend compiles static ETS files, and the assembler (assembly-emitter.cpp) emits the final bytecode. A static ETS file importing a declare namespace with an enum from a dynamic module (configured as language: "js" in arktsconfig.json) causes a crash during bytecode emission.

// test.ets:
import hilog from "dynamic/@ohos.hilog"
let a = hilog.LogLevel.DEBUG
a === 3

//@ohos.hilog.ets:
'use static'
declare namespace hilog {
    enum LogLevel { DEBUG = 3, ... }
}
export default hilog;

//arktsconfig.json:
"dynamic/@ohos.hilog": {"language": "js", "path": ".../@@ohos.hilog.ets", "ohmUrl": "..."}

// Command:
es2panda --arktsconfig arktsconfig.json test.ets

//Result: ASSERTION FAILED: false at assembly-emitter.cpp:833 (UNREACHABLE() in AddBytecodeIndexDependencies).

期望行为是什么?

pass

如何复现该缺陷

// test.ets:
import hilog from "dynamic/@ohos.hilog"
let a = hilog.LogLevel.DEBUG
a === 3

//@ohos.hilog.ets:
'use static'
declare namespace hilog {
    enum LogLevel { DEBUG = 3, ... }
}
export default hilog;

//arktsconfig.json:
"dynamic/@ohos.hilog": {"language": "js", "path": ".../@@ohos.hilog.ets", "ohmUrl": "..."}

// Command:
es2panda --arktsconfig arktsconfig.json test.ets

//Result: ASSERTION FAILED: false at assembly-emitter.cpp:833 (UNREACHABLE() in AddBytecodeIndexDependencies).

其他补充信息

版本或分支信息

likedislike
Aajq257257
8月18日 添加了label:bug
openharmony_ci
openharmony_ci成员
8月18日 评论:

感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 [@xucheng46](https://gitcode.com/xucheng46) [@trubachevilya](https://gitcode.com/trubachevilya) [@vpukhov](https://gitcode.com/vpukhov) [@chernykhsergey](https://gitcode.com/chernykhsergey) [@zhuoli](https://gitcode.com/zhuoli) [@dddzzzhhh](https://gitcode.com/dddzzzhhh) [@Wangyuzhong11](https://gitcode.com/Wangyuzhong11) 。如果需要调整订阅PR、Issue的变更状态,请访问链接。


Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer gitcode for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
8月18日 添加了label:waiting_for_assign
Aajq257257
8月18日 关联了pull request:Crash when static ETS imports dynamic enum
Aajq257257
8月19日 关联了pull request:test for fix when static ETS imports dynamic enum
openharmony_ciopenharmony_ci成员
8月24日 关闭了 issue
openharmony_ciopenharmony_ci成员
8月24日 issue状态由 待办的 改变为 已完成
Lyupa AnastasiaLyupa Anastasia
8月25日 关联了pull request:test for fix when static ETS imports dynamic enum
Lyupa AnastasiaLyupa Anastasia
8月25日 关联了pull request:Crash when static ETS imports dynamic enum