diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2017-10-21 09:53:50 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2017-10-21 09:53:50 +0000 |
commit | f330b1eca90d9a6485765f7b75733672351c89a8 (patch) | |
tree | 48d7c79808055d5104d804c65080c2e63372599c /gcc/ada/gcc-interface/utils.c | |
parent | de624beeae1b049b6bd834b28980e6ce9891d45d (diff) | |
download | gcc-f330b1eca90d9a6485765f7b75733672351c89a8.zip gcc-f330b1eca90d9a6485765f7b75733672351c89a8.tar.gz gcc-f330b1eca90d9a6485765f7b75733672351c89a8.tar.bz2 |
utils.c (pad_type_hash): Use hashval_t for hash value.
* gcc-interface/utils.c (pad_type_hash): Use hashval_t for hash value.
(convert): Do not use an unchecked conversion for converting from a
type to another type padding it.
From-SVN: r253971
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 9945382..bfd3388 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -101,7 +101,7 @@ static tree handle_vector_type_attribute (tree *, tree, tree, int, bool *); /* Fake handler for attributes we don't properly support, typically because they'd require dragging a lot of the common-c front-end circuitry. */ -static tree fake_attribute_handler (tree *, tree, tree, int, bool *); +static tree fake_attribute_handler (tree *, tree, tree, int, bool *); /* Table of machine-independent internal attributes for Ada. We support this minimal set of attributes to accommodate the needs of builtins. */ @@ -222,8 +222,9 @@ static GTY((deletable)) tree free_block_chain; /* A hash table of padded types. It is modelled on the generic type hash table in tree.c, which must thus be used as a reference. */ -struct GTY((for_user)) pad_type_hash { - unsigned long hash; +struct GTY((for_user)) pad_type_hash +{ + hashval_t hash; tree type; }; @@ -4249,10 +4250,13 @@ convert (tree type, tree expr) return convert (type, TREE_OPERAND (expr, 0)); /* If the inner type is of self-referential size and the expression type - is a record, do this as an unchecked conversion. But first pad the - expression if possible to have the same size on both sides. */ + is a record, do this as an unchecked conversion unless both types are + essentially the same. But first pad the expression if possible to + have the same size on both sides. */ if (ecode == RECORD_TYPE - && CONTAINS_PLACEHOLDER_P (DECL_SIZE (TYPE_FIELDS (type)))) + && CONTAINS_PLACEHOLDER_P (DECL_SIZE (TYPE_FIELDS (type))) + && TYPE_MAIN_VARIANT (etype) + != TYPE_MAIN_VARIANT (TREE_TYPE (TYPE_FIELDS (type)))) { if (TREE_CODE (TYPE_SIZE (etype)) == INTEGER_CST) expr = convert (maybe_pad_type (etype, TYPE_SIZE (type), 0, Empty, |