diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-10-25 17:11:49 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-10-25 17:11:49 +0000 |
commit | 90e261e494a5f1fda83b815f513c5621fa5f8c83 (patch) | |
tree | 287ecd3c49a6b519376afa6b2ba709f33d37870a /gcc/tree.h | |
parent | cef026ecafe169871284fded6494efe33e763950 (diff) | |
download | gcc-90e261e494a5f1fda83b815f513c5621fa5f8c83.zip gcc-90e261e494a5f1fda83b815f513c5621fa5f8c83.tar.gz gcc-90e261e494a5f1fda83b815f513c5621fa5f8c83.tar.bz2 |
tree.h (wi::fits_to_tree_p): Accept only 0 and 1 for boolean types.
* tree.h (wi::fits_to_tree_p): Accept only 0 and 1 for boolean types.
* tree.c (int_fits_type_p): Likewise. Adjust head comment.
From-SVN: r241529
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -5295,6 +5295,11 @@ template <typename T> bool wi::fits_to_tree_p (const T &x, const_tree type) { + /* Short-circuit boolean types since various transformations assume that + they can only take values 0 and 1. */ + if (TREE_CODE (type) == BOOLEAN_TYPE) + return eq_p (x, 0) || eq_p (x, 1); + if (TYPE_SIGN (type) == UNSIGNED) return eq_p (x, zext (x, TYPE_PRECISION (type))); else |