Amalgamation compiles with warnings at -O0 (-Wreturn-type) and -O1 (-Wmaybe-uninitialized)
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #1799 来自 @facelessdevhack —— 已合并
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- build-system
调研方向
从合并(amalgamation)构建开始:运行 make amalgamation,然后使用 gcc -Wall -Wextra -O0 -c 和 -O1 编译 build/eigenscript_all.c 以复现警告。-Wreturn-type 警告指向 builtin_tensor_gather,该函数以 ARG_GUARD(1, ...) 结尾;在 raise 之后添加一个显式的 return。-Wmaybe-uninitialized 警告涉及 vm_run_ex 中的 _ad/_bd 以及 vm_index_resolve 中的索引 i;请在声明处将它们初始化。当两次构建都不再输出 warning: 行,并且 make embed-smoke 对此进行防护时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Finding
The release build (make, -O2) is warning-free, but the shipped single-file amalgamation (make amalgamation, build/eigenscript_all.c, the "copy two files" embed path, #397) is not at the other usual optimisation levels. Measured on main 0740af03 with gcc -Wall -Wextra $(cat tools/werror_flags.txt) -c build/eigenscript_all.c:
-O0(the usual embedder debug build): 1 warning,builtin_tensor_gather:control reaches end of non-void function [-Wreturn-type]. The function ends inARG_GUARD(1, ...), whose constant condition-O0does not fold.-O1: 7 warnings, all-Wmaybe-uninitialized:- 5 x
_ad, reached throughnum_to_i64_exact, inlined intovm_run_ex. The bitwise arms read_adafterslot_as_double(_as, &_ad) & slot_as_double(_bs, &_bd), which sets it only on success. - 2 x
i, reached throughvm_index_resolve, inlined intojit_helper_index_set.
- 5 x
All are false positives by inspection, but an embedder compiling eigenscript_all.c with -Wall at -O0 or -O1 gets them. Found while building #1758's C slot test against the amalgamation, which now compiles with the release flags to avoid them.
Done when
- After
make amalgamation,gcc -Wall -Wextra $(cat tools/werror_flags.txt) -O0 -c build/eigenscript_all.cand the same with-O1print nowarning:line (paste both counts in the PR). -
builtin_tensor_gatherends in a statement the compiler can see returns at every level, for example the raise followed by an explicitreturn._ad/_bdand the indexiare initialised where they are declared. - A check keeps it that way. For example,
make embed-smokealso compiles the amalgamation at-O0 -Wall -Wextraand greps the output forwarning:. Planted fault: removing thereturnagain turns it red.
- 主要语言
- C
- 星标
- 3
- 派生
- 7
- 平均合并
- 9 小时 13 分钟
- 30 天内合并 PR
- 372
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InauguralSystems/EigenScript 的其他 Issue
-
area:docs kind:docs-drift
难度 2/5 1-3 小时 新手友好度 76/100
InauguralSystems/EigenScript#1887 ·
维护者通常 1 天内回复
-
area:gates kind:docs-drift
难度 1/5 1 小时以内 新手友好度 86/100
InauguralSystems/EigenScript#1851 ·
维护者通常 1 天内回复
-
area:runtime-vm kind:silent-wrong
难度 2/5 1-3 小时 新手友好度 72/100
InauguralSystems/EigenScript#1748 · 1 条评论 ·
维护者通常 1 天内回复
-
area:gfx bug
难度 2/5 1-3 小时 新手友好度 66/100
InauguralSystems/EigenScript#1684 ·
维护者通常 1 天内回复
-
area:consumer
难度 2/5 1-3 小时 新手友好度 72/100
InauguralSystems/EigenScript#1658 ·
维护者通常 1 天内回复
查看 InauguralSystems/EigenScript 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
libsdl-org/SDL#16607 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
PowerShell/Win32-OpenSSH#2482 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
zephyrproject-rtos/zephyr#123881 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复