aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-expr.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-06-07 23:30:58 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2015-06-07 21:30:58 +0000
commitccb5ad373f204cc5690dabd1298503fde739a8ed (patch)
tree99c2edf394ef8a6f40706dc42eb4d7f0f1f7b48d /gcc/gimple-expr.c
parentd7b35f22be0a732140022245c766fa323f1a768d (diff)
downloadgcc-ccb5ad373f204cc5690dabd1298503fde739a8ed.zip
gcc-ccb5ad373f204cc5690dabd1298503fde739a8ed.tar.gz
gcc-ccb5ad373f204cc5690dabd1298503fde739a8ed.tar.bz2
alias.c (get_alias_set): Be ready for TYPE_CANONICAL of ptr_type_node to not be ptr_to_node.
* alias.c (get_alias_set): Be ready for TYPE_CANONICAL of ptr_type_node to not be ptr_to_node. * tree.c (gimple_types_compatible_p): Do not match TREE_CODE of TREE_TYPE of pointers. * gimple-expr.c (useless_type_conversion): Reorder the check for function pointers and TYPE_CANONICAL. * lto.c (hash_canonical_type): Do not hash TREE_CODE of TREE_TYPE of pointers. * gfortran.dg/lto/bind_c-1_0.f90: New testcase. * gfortran.dg/lto/bind_c-1_1.c: New testcase. * gcc.dg/lto/c-compatible-types_0.c: Rename to ... * gcc.dg/lto/c-compatible-types-1_0.c: this one; fix template * gcc.dg/lto/c-compatible-types_1.c: Rename to ... * gcc.dg/lto/c-compatible-types-1_1.c: this one; harden for -fshort-enum. From-SVN: r224201
Diffstat (limited to 'gcc/gimple-expr.c')
-rw-r--r--gcc/gimple-expr.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index 022437e..d2fbe22 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -84,6 +84,12 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
!= TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
return false;
+ /* Do not lose casts to function pointer types. */
+ if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
+ && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE))
+ return false;
}
/* From now on qualifiers on value types do not matter. */
@@ -142,13 +148,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
- /* Do not lose casts to function pointer types. */
- if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
- && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE))
- return false;
-
/* We do not care for const qualification of the pointed-to types
as const qualification has no semantic value to the middle-end. */