Another UB found using rustlantis
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先,使用 GCC 在 debug 和 release 模式下编译并运行所提供的 Rust 复现程序,然后跟踪报告中提到的 boolean 到 integer 的 cast。当该 cast 始终生成预期的 boolean 值,而不是在不同构建之间产生差异时,问题即得到解决。
由索引模型根据 Issue 内容生成。
描述
This program has a different result under GCC debug and GCC release.
2 1 //debug
2 -1 // release
fn dump_var(var2: usize, val2: usize, var3: usize) {
println!("val2:{val2}")
}
#[inline(never)]
fn dump_var2(var2: usize, val2: usize, var3: usize) {
println!("val2:{val2}")
}
fn fn6(arg: bool, arg2: usize) -> bool {
dump_var(0, arg2, 0);
dump_var2(0, !arg as usize, 0);
true
}
fn main() {
let mut _1 = false;
let mut _3 = 2;
let mut _4 = (&1, 1);
loop {
if _4.1 == 0 {
if _4.1 == 1 {
_1 = true;
} else {
_1 = false;
}
} else if fn6(_1, _3) {
loop {
_3 = _4.1;
let mut _6 = 0;
_6 = 0;
let tmp2 = _6;
if tmp2 == 1 {
_4.0 = &_4.1
} else if tmp2 == 0 {
return;
} else {
break;
}
}
}
}
}
It looks like the cast of val as i128 is nonsensical. Since val is a boolean value, one would expect it to be either 1 or 0, and not -1.
- 主要语言
- Rust
- 星标
- 1.2k
- 派生
- 106
- 平均合并
- 11 小时 14 分钟
- 30 天内合并 PR
- 25
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rust-lang/rustc_codegen_gcc 的其他 Issue
-
tests
难度 2/5 1-3 小时 新手友好度 62/100
rust-lang/rustc_codegen_gcc#993 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 55/100
rust-lang/rustc_codegen_gcc#1020 ·
维护者通常 1 天内回复
-
Cannot compile sysroot if having a build.build-dir cargo config可能已有人在做 @GuillaumeGomez 于 12 天前认领。 未关闭
rust-lang/rustc_codegen_gcc#1011 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
tests
难度 4/5 3-5 天 新手友好度 30/100
rust-lang/rustc_codegen_gcc#992 ·
维护者通常 1 天内回复
-
bug
难度 5/5 一周以上 新手友好度 35/100
rust-lang/rustc_codegen_gcc#970 · 5 条评论 ·
维护者通常 1 天内回复
查看 rust-lang/rustc_codegen_gcc 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
longbridge/nsh#804 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
devex good first issue
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
calcit-lang/calcit#2538 ·
维护者通常 1 天内回复