summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-08-13 08:19:10 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-08-13 08:19:10 +0000
commite5fdcd8cc54cacb910bd9730ce60626b155f1bb1 (patch)
tree19e33361b8467654e1998b29231dec999536e09a /gcc/tree-ssa.c
parent61a28f2135b9e22ef505ee60f92031a48263e0b0 (diff)
downloadgcc-e5fdcd8cc54cacb910bd9730ce60626b155f1bb1.tar.gz
re PR middle-end/41047 (gcc.target/mips/memcpy-1.c failing)
2009-08-13 Richard Guenther <rguenther@suse.de> PR middle-end/41047 * tree-ssa-ccp.c (ccp_fold): When folding pointer additions use the constant pointer type. * gimplify.c (canonicalize_addr_expr): Canonicalize independent of CV qualifiers on the target pointer type. * tree-ssa.c (useless_type_conversion_p): Move incomplete pointer conversion check before restrict check. * gcc.dg/tree-ssa/ssa-ccp-27.c: New testcase. From-SVN: r150715
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index a40270335df..76e4e8b7f1b 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -874,6 +874,16 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
+ /* If the outer type is (void *) or a pointer to an incomplete
+ record type, then the conversion is not necessary. */
+ if (VOID_TYPE_P (TREE_TYPE (outer_type))
+ || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type))
+ && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE
+ && (TREE_CODE (TREE_TYPE (outer_type))
+ == TREE_CODE (TREE_TYPE (inner_type)))
+ && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))))
+ return true;
+
/* Do not lose casts to restrict qualified pointers. */
if ((TYPE_RESTRICT (outer_type)
!= TYPE_RESTRICT (inner_type))
@@ -930,16 +940,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
- /* If the outer type is (void *) or a pointer to an incomplete
- record type, then the conversion is not necessary. */
- if (VOID_TYPE_P (TREE_TYPE (outer_type))
- || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type))
- && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE
- && (TREE_CODE (TREE_TYPE (outer_type))
- == TREE_CODE (TREE_TYPE (inner_type)))
- && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))))
- return true;
-
/* Don't lose casts between pointers to volatile and non-volatile
qualified types. Doing so would result in changing the semantics
of later accesses. For function types the volatile qualifier