{"record":{"id":"b7ad13b005048293","repo":"rust-lang/rust","slug":"rustc-codegen-gcc-doesn-t-support-scalable-vecto","errorCode":null,"errorMessage":"`rustc_codegen_gcc` doesn't support scalable vectors yet","messagePattern":"`rustc_codegen_gcc` doesn't support scalable vectors yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/rustc_codegen_gcc/src/builder.rs","lineNumber":1464,"sourceCode":"        size: RValue<'gcc>,\n        _align: Align,\n        flags: MemFlags,\n    ) {\n        assert!(!flags.contains(MemFlags::NONTEMPORAL), \"non-temporal memset not supported\");\n        let _is_volatile = flags.contains(MemFlags::VOLATILE);\n        let ptr = self.pointercast(ptr, self.type_i8p());\n        let memset = self.context.get_builtin_function(\"memset\");\n        // FIXME(antoyo): handle align and is_volatile.\n        let fill_byte = self.context.new_cast(self.location, fill_byte, self.i32_type);\n        let size = self.intcast(size, self.type_size_t(), false);\n        self.block.add_eval(\n            self.location,\n            self.context.new_call(self.location, memset, &[ptr, fill_byte, size]),\n        );\n    }\n\n    fn vscale(&mut self, _: Self::Type) -> Self::Value {\n        unimplemented!(\"`rustc_codegen_gcc` doesn't support scalable vectors yet\")\n    }\n\n    fn select(\n        &mut self,\n        cond: RValue<'gcc>,\n        then_val: RValue<'gcc>,\n        mut else_val: RValue<'gcc>,\n    ) -> RValue<'gcc> {\n        let func = self.current_func();\n        let variable = func.new_local(self.location, then_val.get_type(), \"selectVar\");\n        let then_block = func.new_block(\"then\");\n        let else_block = func.new_block(\"else\");\n        let after_block = func.new_block(\"after\");\n        self.llbb().end_with_conditional(self.location, cond, then_block, else_block);\n\n        then_block.add_assignment(self.location, variable, then_val);\n        then_block.end_with_jump(self.location, after_block);\n","sourceCodeStart":1446,"sourceCodeEnd":1482,"githubUrl":"https://github.com/rust-lang/rust/blob/7088e4b63a9516ebfbfe2ab2d999cf01a528ac14/compiler/rustc_codegen_gcc/src/builder.rs#L1446-L1482","documentation":"Builder::vscale (builder.rs:1464) is explicitly unimplemented with the message \"rustc_codegen_gcc doesn't support scalable vectors yet\". vscale returns the runtime scaling factor for scalable vector types (SVE on AArch64, RISC-V V extension). GCC's libgccjit exposure used by this backend does not model scalable vectors, so the call is intentionally a panic rather than silent miscompilation.","triggerScenarios":"Compiling code that references the SVE or RISC-V vector intrinsic vscale, or that lowers to scalable-vector MIR types, on the GCC backend. Triggered explicitly when std::arch intrinsics for scalable vectors are codegenned.","commonSituations":"Targeting aarch64 with SVE-enabled code, RISC-V with the V extension, or any path that produces scalable vector types and using -Zcodegen-backend=gcc. Also seen when a dependency auto-detects and emits SVE intrinsics.","solutions":["Use the LLVM backend (the only backend here that supports scalable vectors) when compiling SVE/RISC-V-V code.","Disable scalable-vector features for the build target (e.g. remove +sve, +sve2, or +v from target-features) so only fixed-width vectors are used.","Avoid the specific std::arch intrinsics or libraries (e.g. wide, std::simd scalable types) that lower to vscale.","Track upstream support for scalable vectors in rustc_codegen_gcc; do not attempt to patch without gccjit API support."],"exampleFix":"// before: target with scalable vectors, codegen via gcc backend\n// RUSTFLAGS=\"-Zcodegen-backend=gcc -Ctarget-feature=+sve\"\n\n// after: drop the gcc backend for SVE code, or drop SVE\n// RUSTFLAGS=\"-Ctarget-feature=+sve\"   # LLVM backend (default)\n// or\n// RUSTFLAGS=\"-Zcodegen-backend=gcc\"   # no +sve","handlingStrategy":"validation","validationCode":"# Before building with the gcc backend, ensure no scalable-vector features.\nif echo \"$RUSTFLAGS\" | grep -q '+sve\\|+sve2\\|+v\\|scalable'; then\n  echo 'Scalable vectors are unsupported by rustc_codegen_gcc; remove the feature or use LLVM.'\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":"if ! RUSTFLAGS=\"-Zcodegen-backend=gcc\" cargo build 2>err.log; then\n  grep -q 'scalable vectors' err.log && {\n    echo 'Scalable vectors need the LLVM backend; retrying without gcc backend'\n    RUSTFLAGS=\"${RUSTFLAGS//-Zcodegen-backend=gcc/}\" cargo build\n  }\nfi","preventionTips":["Never combine -Zcodegen-backend=gcc with +sve/+sve2/+v target features.","Gate SVE/RISC-V-V code behind #[cfg] and only compile it on the LLVM lane.","Document scalable-vector usage so backend selection can avoid the gcc backend."],"tags":["rust","rustc-codegen-gcc","scalable-vectors","sve","risc-v","simd"],"backgroundTag":null,"analyzedSha":"7088e4b63a9516ebfbfe2ab2d999cf01a528ac14","analyzedAt":"2026-08-10T14:17:03.603Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}