Skip to content

compiler fails on arithmetic operations #134457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ohad-agadi opened this issue Dec 18, 2024 · 1 comment · Fixed by #135484
Closed

compiler fails on arithmetic operations #134457

ohad-agadi opened this issue Dec 18, 2024 · 1 comment · Fixed by #135484
Assignees
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. llvm-fixed-upstream Issue expected to be fixed by the next major LLVM upgrade, or backported fixes T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ohad-agadi
Copy link

ohad-agadi commented Dec 18, 2024

I have a struct representing circle points over field elements (represented as u32)

impl<F: Zero + Add<Output = F> + FieldExpOps + Sub<Output = F> + Neg<Output = F>> Add
    for CirclePoint<F>
{
    type Output = Self;

    fn add(self, rhs: Self) -> Self::Output {
        let x = self.x.clone() * rhs.x.clone() - self.y.clone() * rhs.y.clone();
        let y = self.x * rhs.y + self.y * rhs.x;
        Self { x, y }
    }
}

link to the code: https://github.com/starkware-libs/stwo/blob/4053f974dcd29812a8c775205bc107e56a026a5b/crates/prover/src/core/circle.rs#L126-L134

running cargo bench with RUSTFLAGS="-C target-cpu=native -C target-feature=+avx512f -C opt-level=3",
the compiler fails with the following error:
error: rustc interrupted by SIGSEGV, backtrace is given below

however, the following code does manage to compile:

impl<F: Zero + Add<Output = F> + FieldExpOps + Sub<Output = F> + Neg<Output = F>> Add
    for CirclePoint<F>
{
    type Output = Self;

    fn add(self, rhs: Self) -> Self::Output {
        let x = self.x.clone() * rhs.x.clone() + (- self.y.clone() * rhs.y.clone());
        let y = self.x * rhs.y + self.y * rhs.x;
        Self { x, y }
    }
}

Meta

rustc --version --verbose:

nightly 2024-12-16
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(+0x3720263)[0x7a421d120263]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7a4219819520]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(_ZN4llvm17SLPVectorizerPass22vectorizeChainsInBlockEPNS_10BasicBlockERNS_13slpvectorizer7BoUpSLPE+0x6b0)[0x7a4217f6e7b0]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(_ZN4llvm17SLPVectorizerPass7runImplERNS_8FunctionEPNS_15ScalarEvolutionEPNS_19TargetTransformInfoEPNS_17TargetLibraryInfoEPNS_9AAResultsEPNS_8LoopInfoEPNS_13DominatorTreeEPNS_15AssumptionCacheEPNS_12DemandedBitsEPNS_25OptimizationRemarkEmitterE+0x1191)[0x7a421811ba55]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(_ZN4llvm17SLPVectorizerPass3runERNS_8FunctionERNS_15AnalysisManagerIS1_JEEE+0x1cb)[0x7a421811a81d]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(+0x691a64d)[0x7a421811a64d]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(_ZN4llvm11PassManagerINS_8FunctionENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x76d)[0x7a4217a1bebb]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(_ZN4llvm27ModuleToFunctionPassAdaptor3runERNS_6ModuleERNS_15AnalysisManagerIS1_JEEE+0x38d)[0x7a4217a141cd]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(+0x6213e2b)[0x7a4217a13e2b]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/libLLVM.so.19.1-rust-1.85.0-nightly(_ZN4llvm11PassManagerINS_6ModuleENS_15AnalysisManagerIS1_JEEEJEE3runERS1_RS3_+0x22b)[0x7a42180e336b]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(LLVMRustOptimize+0x84d)[0x7a421f7c9ed9]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(+0x5dc63ab)[0x7a421f7c63ab]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(+0x5dc5efe)[0x7a421f7c5efe]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(_RNvXs1_Cs3ztSSGqllq_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCs43NrWYAXHhA_17rustc_codegen_ssa6traits5write19WriteBackendMethods12optimize_fat+0x34)[0x7a421cf9d6a4]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(_RINvNtNtCsbfBZt64eLhN_3std3sys9backtrace28___rust_begin_short_backtraceNCINvXs0_Cs3ztSSGqllq_18rustc_codegen_llvmNtB1g_18LlvmCodegenBackendNtNtNtCs43NrWYAXHhA_17rustc_codegen_ssa6traits7backend19ExtraBackendMethods18spawn_named_threadNCINvNtNtB2j_4back5write10spawn_workB1N_E0uE0uEB1g_+0xc21)[0x7a421f7aa961]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(+0x5dbd9ea)[0x7a421f7bd9ea]
/home/runner/.rustup/toolchains/nightly-2024-12-16-x86_64-unknown-linux-gnu/lib/librustc_driver-373018000622b1f2.so(+0x5dbddc1)[0x7a421f7bddc1]
/lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7a421986bac3]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x44)[0x7a42198fca04

@ohad-agadi ohad-agadi added the C-bug Category: This is a bug. label Dec 18, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 18, 2024
@fmease fmease added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. labels Dec 18, 2024
@fmease fmease changed the title compiler failes on arithmetic operations compiler fails on arithmetic operations Dec 18, 2024
@fmease fmease added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Dec 18, 2024
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 18, 2024
@dianqk dianqk added the A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. label Dec 18, 2024
@dianqk dianqk self-assigned this Dec 18, 2024
@dianqk
Copy link
Member

dianqk commented Dec 18, 2024

Upstream issue: llvm/llvm-project#120433

@dianqk dianqk added the llvm-fixed-upstream Issue expected to be fixed by the next major LLVM upgrade, or backported fixes label Dec 19, 2024
@bors bors closed this as completed in d61f55d Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-target-feature Area: Enabling/disabling target features like AVX, Neon, etc. C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. llvm-fixed-upstream Issue expected to be fixed by the next major LLVM upgrade, or backported fixes T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants