Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Amalgamation compiles with warnings at -O0 (-Wreturn-type) and -O1 (-Wmaybe-uninitialized)

已关闭 适合新手
#1,775 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 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 内容生成。

描述

area:embed bug found-by:code-review kind:gate-defect

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 in ARG_GUARD(1, ...), whose constant condition -O0 does not fold.
  • -O1: 7 warnings, all -Wmaybe-uninitialized:
    • 5 x _ad, reached through num_to_i64_exact, inlined into vm_run_ex. The bitwise arms read _ad after slot_as_double(_as, &_ad) & slot_as_double(_bs, &_bd), which sets it only on success.
    • 2 x i, reached through vm_index_resolve, inlined into jit_helper_index_set.

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.c and the same with -O1 print no warning: line (paste both counts in the PR).
  • builtin_tensor_gather ends in a statement the compiler can see returns at every level, for example the raise followed by an explicit return. _ad/_bd and the index i are initialised where they are declared.
  • A check keeps it that way. For example, make embed-smoke also compiles the amalgamation at -O0 -Wall -Wextra and greps the output for warning:. Planted fault: removing the return again turns it red.
主要语言
C
星标
3
派生
7
平均合并
9 小时 13 分钟
30 天内合并 PR
372

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

InauguralSystems/EigenScript 的其他 Issue

查看 InauguralSystems/EigenScript 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。