From: Martin Liska Date: Thu, 27 Jul 2017 12:58:07 +0000 (+0200) Subject: Validate that Init value is within range defined by IntegerRange. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e88a93840b20153a80b9504b3233e58012b009d5;p=gcc.git Validate that Init value is within range defined by IntegerRange. 2017-07-27 Martin Liska * opt-functions.awk: Add validation of value of Init. * optc-gen.awk: Pass new argument. From-SVN: r250625 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bcfe5f8fb2e..3beab6c5251 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,11 @@ * config/sparc/sparc.c (sparc_option_override): Set MASK_FSMULD flag earlier and only if MASK_FPU is set. Adjust formatting. +2017-07-27 Martin Liska + + * opt-functions.awk: Add validation of value of Init. + * optc-gen.awk: Pass new argument. + 2017-07-27 Martin Liska * auto-profile.c (autofdo_source_profile::update_inlined_ind_target): diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk index ad0b52c0903..5ee93f12feb 100644 --- a/gcc/opt-functions.awk +++ b/gcc/opt-functions.awk @@ -314,11 +314,13 @@ function search_var_name(name, opt_numbers, opts, flags, n_opts) return "" } -function integer_range_info(range_option) +function integer_range_info(range_option, init, option) { if (range_option != "") { start = nth_arg(0, range_option); end = nth_arg(1, range_option); + if (init != "" && init != "-1" && (init < start || init > end)) + print "#error initial value " init " of '" option "' must be in range [" start "," end "]" return start ", " end } else diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index 45b1b95e7ec..3cb0005ba40 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -400,7 +400,8 @@ for (i = 0; i < n_opts; i++) { " 0, %s,\n", cl_flags, cl_bit_fields) printf(" %s, %s, %s }%s\n", var_ref(opts[i], flags[i]), - var_set(flags[i]), integer_range_info(opt_args("IntegerRange", flags[i])), comma) + var_set(flags[i]), integer_range_info(opt_args("IntegerRange", flags[i]), + opt_args("Init", flags[i]), opts[i]), comma) } print "};"