From 8e3ccd9c9bce2830581596d496e130cb43c179d0 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 12 Mar 2016 16:01:34 +0530 Subject: [PATCH] Don't allow values for codegen-units less than 1 (fixes #32191) --- src/librustc/session/config.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 679da4abf5f..dba0bcf19be 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1095,6 +1095,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { } } + if cg.codegen_units < 1 { + early_error(error_format, "Value for codegen units must be a positive nonzero integer"); + } + let cg = cg; let sysroot_opt = matches.opt_str("sysroot").map(|m| PathBuf::from(&m));