rust-lang / rust-lang/rust

Regression in calculating value of `Result`

Open
#155,985 8 comments 0 reactions 1 assignee View on GitHub

@el-ev is already working on this.

Since May 7, 2026.

A-LLVM C-bug I-heavy P-medium regression-untriaged
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

I tried this code:
https://godbolt.org/z/aG9G6o7Ee

I expected to see this happen: not to have huge constants like 4294967297 which have bits set higher than the return value's size.

Instead, this happened: it had them.

Version it worked on

It most recently worked on: 1.94 (1.95 had an LLVM upgrade)

Version with regression

1.95+

@@ -1,8 +1,16 @@
 example::ignore_ok:
-	cmp     edi, 1
-	mov     ecx, 2
-	sbb     ecx, 0
 	xor     eax, eax
+	test    edi, edi
+	setne   al
+	shl     rax, 32
+	movabs  rcx, 4294967297
+	add     rcx, rax
+	xor     edx, edx
 	test    esi, esi
-	cmove   eax, ecx
+	mov     eax, 0
+	cmove   rax, rcx
+	mov     ecx, eax
+	shr     rax, 32
+	test    cl, cl
+	cmove   eax, edx
 	ret

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.