Skip to content

loongson3: disable zero division check#89

Open
xry111 wants to merge 1 commit into
masterfrom
mips-no-div-zero-check
Open

loongson3: disable zero division check#89
xry111 wants to merge 1 commit into
masterfrom
mips-no-div-zero-check

Conversation

@xry111

@xry111 xry111 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

In other five architectures supported by AOSC, there are four without this check: arm64, loongarch64, ppc64, and riscv64.

So it does not make too much sense to keep the historical behavior mimicking amd64 here.

In other five architectures supported by AOSC, there are four without
this check: arm64, loongarch64, ppc64, and riscv64.

So it does not make too much sense to keep the historical behavior
mimicking amd64 here.
@xry111 xry111 force-pushed the mips-no-div-zero-check branch from 6879f99 to da295b7 Compare June 13, 2026 11:46
@MingcongBai

Copy link
Copy Markdown
Member

Probably a good catch but we needed more compelling reasoning other than "all others do the same"... It also brings forth the question as to whether we should look into why this wasn't done on the upstream's end.

@MingcongBai

Copy link
Copy Markdown
Member

cc @Cyanoxygen @chenx97

@xry111

xry111 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

"All others do the same" explains why relying on SIGFPE to detect division by zero would not work in practice. OTOH, in C and C++ division by zero invokes undefined behavior so you cannot rely on the SIGFPE to detect division by zero even in theory, and in Rust division by zero panics so the inserted trap is simply never reachable.

IMO at the very least the Rust part should be upstreamed.

@xry111

xry111 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

IMO at the very least the Rust part should be upstreamed.

rust-lang/rust#157873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants