aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-06-09 09:31:14 +0200
committerRichard Biener <rguenther@suse.de>2023-06-28 08:15:48 +0200
commitfe48f2651334bc4d96b6df6b2bb6b29fcb732a83 (patch)
tree17b6a99417de436399e7e6d326c51185e45d14fb /gcc/tree.cc
parentabdf0b6cdff5783b97f35ad61ae31433f0569dfd (diff)
downloadgcc-fe48f2651334bc4d96b6df6b2bb6b29fcb732a83.zip
gcc-fe48f2651334bc4d96b6df6b2bb6b29fcb732a83.tar.gz
gcc-fe48f2651334bc4d96b6df6b2bb6b29fcb732a83.tar.bz2
Prevent TYPE_PRECISION on VECTOR_TYPEs
The following makes sure that using TYPE_PRECISION on VECTOR_TYPE ICEs when tree checking is enabled. This should avoid wrong-code in cases like PR110182 and instead ICE. It also introduces a TYPE_PRECISION_RAW accessor and adjusts places I found that are eligible to use that. * tree.h (TYPE_PRECISION): Check for non-VECTOR_TYPE. (TYPE_PRECISION_RAW): Provide raw access to the precision field. * tree.cc (verify_type_variant): Compare TYPE_PRECISION_RAW. (gimple_canonical_types_compatible_p): Likewise. * tree-streamer-out.cc (pack_ts_type_common_value_fields): Stream TYPE_PRECISION_RAW. * tree-streamer-in.cc (unpack_ts_type_common_value_fields): Likewise. * lto-streamer-out.cc (hash_tree): Hash TYPE_PRECISION_RAW. gcc/lto/ * lto-common.cc (compare_tree_sccs_1): Use TYPE_PRECISION_RAW.
Diffstat (limited to 'gcc/tree.cc')
-rw-r--r--gcc/tree.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 8e144bc..58288ef 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -13423,7 +13423,7 @@ verify_type_variant (const_tree t, tree tv)
}
verify_variant_match (TYPE_NEEDS_CONSTRUCTING);
}
- verify_variant_match (TYPE_PRECISION);
+ verify_variant_match (TYPE_PRECISION_RAW);
if (RECORD_OR_UNION_TYPE_P (t))
verify_variant_match (TYPE_TRANSPARENT_AGGR);
else if (TREE_CODE (t) == ARRAY_TYPE)
@@ -13701,8 +13701,8 @@ gimple_canonical_types_compatible_p (const_tree t1, const_tree t2,
|| TREE_CODE (t1) == OFFSET_TYPE
|| POINTER_TYPE_P (t1))
{
- /* Can't be the same type if they have different recision. */
- if (TYPE_PRECISION (t1) != TYPE_PRECISION (t2))
+ /* Can't be the same type if they have different precision. */
+ if (TYPE_PRECISION_RAW (t1) != TYPE_PRECISION_RAW (t2))
return false;
/* In some cases the signed and unsigned types are required to be