Skip to content

Conversation

@ZhongyaoChen
Copy link
Contributor

The overflow-checks codegen test was failing on riscv64gc target because the FileCheck pattern did not account for ABI extension attributes. RISC-V LP64 ABI requires integer types smaller than XLEN (64-bit) to be zero-extended or sign-extended to register width.

For u8 parameters, RISC-V generates:
i8 noundef zeroext %a, i8 noundef zeroext %b

While x86_64 and aarch64 generate:
i8 noundef %a, i8 noundef %b

The original CHECK pattern only matched the format without the zeroext attribute, causing test failures on RISC-V.

This patch makes the zeroext attribute optional in the FileCheck pattern using {{( zeroext)?}}, allowing the test to pass on architectures that add ABI extension attributes (e.g., RISC-V).

Test results before fix:

  • x86_64-unknown-linux-gnu: 3 passed
  • aarch64-unknown-linux-gnu: 3 passed
  • riscv64gc-unknown-linux-gnu: 1 passed, 2 failed

Test results after fix:

  • x86_64-unknown-linux-gnu: 3 passed
  • aarch64-unknown-linux-gnu: 3 passed
  • riscv64gc-unknown-linux-gnu: 3 passed

The overflow-checks codegen test was failing on riscv64gc target
because the FileCheck pattern did not account for ABI extension
attributes. RISC-V LP64 ABI requires integer types smaller than
XLEN (64-bit) to be zero-extended or sign-extended to register width.

For u8 parameters, RISC-V generates:
  i8 noundef zeroext %a, i8 noundef zeroext %b

While x86_64 and aarch64 generate:
  i8 noundef %a, i8 noundef %b

The original CHECK pattern only matched the format without the
`zeroext` attribute, causing test failures on RISC-V.

This patch makes the zeroext attribute optional in the FileCheck
pattern using `{{( zeroext)?}}`, allowing the test to pass on
architectures that add ABI extension attributes (e.g., RISC-V).

Test results before fix:
- x86_64-unknown-linux-gnu: 3 passed
- aarch64-unknown-linux-gnu: 3 passed
- riscv64gc-unknown-linux-gnu: 1 passed, 2 failed

Test results after fix:
- x86_64-unknown-linux-gnu: 3 passed
- aarch64-unknown-linux-gnu: 3 passed
- riscv64gc-unknown-linux-gnu: 3 passed
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 12, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@Mark-Simulacrum
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 15, 2025

📌 Commit eef09cf has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 15, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 15, 2025
…ecks-test-fail, r=Mark-Simulacrum

Fix overflow-checks test for RISC-V target

The overflow-checks codegen test was failing on riscv64gc target because the FileCheck pattern did not account for ABI extension attributes. RISC-V LP64 ABI requires integer types smaller than XLEN (64-bit) to be zero-extended or sign-extended to register width.

For u8 parameters, RISC-V generates:
  i8 noundef zeroext %a, i8 noundef zeroext %b

While x86_64 and aarch64 generate:
  i8 noundef %a, i8 noundef %b

The original CHECK pattern only matched the format without the `zeroext` attribute, causing test failures on RISC-V.

This patch makes the zeroext attribute optional in the FileCheck pattern using `{{( zeroext)?}}`, allowing the test to pass on architectures that add ABI extension attributes (e.g., RISC-V).

Test results before fix:
- x86_64-unknown-linux-gnu: 3 passed
- aarch64-unknown-linux-gnu: 3 passed
- riscv64gc-unknown-linux-gnu: 1 passed, 2 failed

Test results after fix:
- x86_64-unknown-linux-gnu: 3 passed
- aarch64-unknown-linux-gnu: 3 passed
- riscv64gc-unknown-linux-gnu: 3 passed
bors added a commit that referenced this pull request Nov 16, 2025
Rollup of 10 pull requests

Successful merges:

 - #148416 (`vec_recycle`: implementation)
 - #148522 (Micro-optimize rustdoc search index parsing)
 - #148827 (Stabilize vec_into_raw_parts)
 - #148832 (Bump library dependencies)
 - #148836 (tweak primitive reference docs)
 - #148859 (Fix overflow-checks test for RISC-V target)
 - #148886 (Add riscv64a23-unknown-linux-gnu to build-manifest TARGETS)
 - #148956 (re-enable wasm abi test)
 - #148963 (runtest.rs: remove redundant check)
 - #148968 (Add another *ExprWithBlock* test for `try` blocks)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Nov 16, 2025
Rollup of 11 pull requests

Successful merges:

 - #148416 (`vec_recycle`: implementation)
 - #148522 (Micro-optimize rustdoc search index parsing)
 - #148827 (Stabilize vec_into_raw_parts)
 - #148832 (Bump library dependencies)
 - #148836 (tweak primitive reference docs)
 - #148859 (Fix overflow-checks test for RISC-V target)
 - #148886 (Add riscv64a23-unknown-linux-gnu to build-manifest TARGETS)
 - #148956 (re-enable wasm abi test)
 - #148963 (runtest.rs: remove redundant check)
 - #148968 (Add another *ExprWithBlock* test for `try` blocks)
 - #148984 (chore: Update annotate-snippets to 0.12.9)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 38b5341 into rust-lang:main Nov 16, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 16, 2025
rust-timer added a commit that referenced this pull request Nov 16, 2025
Rollup merge of #148859 - ZhongyaoChen:fix-riscv-overflow-checks-test-fail, r=Mark-Simulacrum

Fix overflow-checks test for RISC-V target

The overflow-checks codegen test was failing on riscv64gc target because the FileCheck pattern did not account for ABI extension attributes. RISC-V LP64 ABI requires integer types smaller than XLEN (64-bit) to be zero-extended or sign-extended to register width.

For u8 parameters, RISC-V generates:
  i8 noundef zeroext %a, i8 noundef zeroext %b

While x86_64 and aarch64 generate:
  i8 noundef %a, i8 noundef %b

The original CHECK pattern only matched the format without the `zeroext` attribute, causing test failures on RISC-V.

This patch makes the zeroext attribute optional in the FileCheck pattern using `{{( zeroext)?}}`, allowing the test to pass on architectures that add ABI extension attributes (e.g., RISC-V).

Test results before fix:
- x86_64-unknown-linux-gnu: 3 passed
- aarch64-unknown-linux-gnu: 3 passed
- riscv64gc-unknown-linux-gnu: 1 passed, 2 failed

Test results after fix:
- x86_64-unknown-linux-gnu: 3 passed
- aarch64-unknown-linux-gnu: 3 passed
- riscv64gc-unknown-linux-gnu: 3 passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants