aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2019-09-09 11:44:23 +0200
committerJose E. Marchesi <jemarch@gcc.gnu.org>2019-09-09 11:44:23 +0200
commit4bc8aadf033c7dbbbb16ba99e3260da0c0fd39bf (patch)
treea72d02aba934c07b325235d29ee1fa348b77e9e3 /gcc
parentb7b1f65711bdea483481c475fa31634ee091068f (diff)
downloadgcc-4bc8aadf033c7dbbbb16ba99e3260da0c0fd39bf.zip
gcc-4bc8aadf033c7dbbbb16ba99e3260da0c0fd39bf.tar.gz
gcc-4bc8aadf033c7dbbbb16ba99e3260da0c0fd39bf.tar.bz2
opt-functions.awk: fix comparison of limit, begin and end
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. From-SVN: r275503
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/opt-functions.awk7
2 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c39e0d4..a8c3a2a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-09 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * opt-functions.awk (integer_range_info): Make sure values are in
+ numeric context before operating with them.
+
2019-09-08 Segher Boessenkool <segher@kernel.crashing.org>
* genemit.c (gen_split): Print the filename and line number where the
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 1190e6d..c1da80c 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -346,9 +346,10 @@ 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);
- if (init != "" && init != "-1" && (init < start || init > end))
+ ival = init + 0;
+ start = nth_arg(0, range_option) + 0;
+ end = nth_arg(1, range_option) + 0;
+ if (init != "" && init != "-1" && (ival < start || ival > end))
print "#error initial value " init " of '" option "' must be in range [" start "," end "]"
return start ", " end
}