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

AvoidReinterprets: `i32.atomic.load` under `f32.reinterpret_i32` loses its atomicity

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

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #9228 来自 @tamaroning —— 已合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
wasm
领域
compilers

调研方向

从 AvoidReinterprets pass 中的 makeReinterpretedLoad 开始,使用提供的 .wat 模块通过 wasm-opt --avoid-reinterprets --print 重现该问题。完成的标准是 i32.atomic.load 不会被重写为非原子 f32.load,同时保留原始的访问行为。

由索引模型根据 Issue 内容生成。

描述

Summary

makeReinterpretedLoad rebuilds the load from bytes/offset/align/ptr/type/memory and does not carry over isAtomic.

Root cause

The rebuilt load copies the listed fields only, so the original load's isAtomic is dropped.

Copying isAtomic is not a fix, because atomic loads exist only for i32 and i64 (the validator rejects other types) and the rebuilt load has type f32. The pass should skip atomic loads.

Affected passes

Only AvoidReinterprets.

Reproducer
(module (memory 1 1)
  (func (export "f") (param $p i32) (result f32)
    (f32.reinterpret_i32 (i32.atomic.load (local.get $p)))))
$ wasm-opt in.wat -all --avoid-reinterprets --print
 (func $0 (type $0) (param $p i32) (result f32)
  (f32.load
   (local.get $p)
  )
 )

The i32.atomic.load has become a plain f32.load.

Expected vs actual

An unaligned address that traps for the atomic access no longer traps, and on a shared memory the access is no longer atomic.

Version

Reproduced on upstream main at 4d8ac549e2ab9b283246ea95e79ebe139ca579ac (wasm-opt version 133).

AI was used as part of the process of finding this issue. I have manually checked and reproduced it.

主要语言
WebAssembly
星标
8.7k
派生
895
平均合并
1 天 21 小时
30 天内合并 PR
95

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

WebAssembly/binaryen 的其他 Issue

查看 WebAssembly/binaryen 的全部 Issue

相似的 Issue

更多 Compilers Issue

把新 issue 发到你的邮箱

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