diff options
author | Xi Ruoyao <xry111@mengyan1223.wang> | 2022-03-09 11:46:03 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@mengyan1223.wang> | 2022-03-09 17:27:23 +0800 |
commit | 1c7b110e1e44da0c93d0d011f5109c5d09bf4399 (patch) | |
tree | 2695ccafb62c217f1106fddd4c98daf10e61cd38 /gcc | |
parent | a5c9b7c4f95ef77b83da82241cabdf80d8b1cad5 (diff) | |
download | gcc-1c7b110e1e44da0c93d0d011f5109c5d09bf4399.zip gcc-1c7b110e1e44da0c93d0d011f5109c5d09bf4399.tar.gz gcc-1c7b110e1e44da0c93d0d011f5109c5d09bf4399.tar.bz2 |
vect: fix out-of-bound access in supports_vec_convert_optab_p [PR 104851]
Calling VECTOR_MODE_P with MAX_MACHINE_MODE has caused out-of-bound
access.
gcc/
PR tree-optimization/104851
* optabs-query.cc (supports_vec_convert_optab_p): Fix off-by-one
error.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/optabs-query.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/optabs-query.cc b/gcc/optabs-query.cc index 713c098..68dc679 100644 --- a/gcc/optabs-query.cc +++ b/gcc/optabs-query.cc @@ -720,7 +720,7 @@ static bool supports_vec_convert_optab_p (optab op, machine_mode mode) { int start = mode == VOIDmode ? 0 : mode; - int end = mode == VOIDmode ? MAX_MACHINE_MODE : mode; + int end = mode == VOIDmode ? MAX_MACHINE_MODE - 1 : mode; for (int i = start; i <= end; ++i) if (VECTOR_MODE_P ((machine_mode) i)) for (int j = MIN_MODE_VECTOR_INT; j < MAX_MODE_VECTOR_INT; ++j) |