This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH V3 02/11] opt-functions.awk: fix comparison of limit, begin and end
- From: "Jose E. Marchesi" <jose dot marchesi at oracle dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Aug 2019 19:14:41 +0200
- Subject: [PATCH V3 02/11] opt-functions.awk: fix comparison of limit, begin and end
- References: <20190826171450.1971-1-jose.marchesi@oracle.com>
The function integer_range_info makes sure that, if provided, the
initial value fills in the especified range. However, it is necessary
to convert the values to a numerical context before comparing, to make
sure awk is using arithmetical order and not lexicographical order.
gcc/ChangeLog:
* opt-functions.awk (integer_range_info): Make sure values are in
numeric context before operating with them.
---
gcc/ChangeLog | 5 +++++
gcc/opt-functions.awk | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 1190e6d6b66..0b28a6c3bff 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -346,8 +346,9 @@ function search_var_name(name, opt_numbers, opts, flags, n_opts)
function integer_range_info(range_option, init, option)
{
if (range_option != "") {
- start = nth_arg(0, range_option);
- end = nth_arg(1, range_option);
+ init = init + 0;
+ start = nth_arg(0, range_option) + 0;
+ end = nth_arg(1, range_option) + 0;
if (init != "" && init != "-1" && (init < start || init > end))
print "#error initial value " init " of '" option "' must be in range [" start "," end "]"
return start ", " end
--
2.11.0