aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-07-08 18:34:37 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-07-08 18:34:37 +0200
commit4c44c315d4f300b0effee18306c026f05a29bcb8 (patch)
treea8975fb9c41eb56aa01f13bb3de2d9eef818b190 /gcc/tree-sra.c
parentc91457541d06789db54fa7ce42fba6a91f53bafe (diff)
downloadgcc-4c44c315d4f300b0effee18306c026f05a29bcb8.zip
gcc-4c44c315d4f300b0effee18306c026f05a29bcb8.tar.gz
gcc-4c44c315d4f300b0effee18306c026f05a29bcb8.tar.bz2
tree-sra.c (sra_build_assignment): Handle CONVERT_EXPR_P dst.
* tree-sra.c (sra_build_assignment): Handle CONVERT_EXPR_P dst. From-SVN: r137633
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r--gcc/tree-sra.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index c50c6cd..16f719e 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -2282,6 +2282,9 @@ sra_build_assignment (tree dst, tree src)
var = utmp;
}
+ /* fold_build3 (BIT_FIELD_REF, ...) sometimes returns a cast. */
+ STRIP_NOPS (dst);
+
/* Finally, move and convert to the destination. */
if (!useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (var)))
{
@@ -2306,6 +2309,12 @@ sra_build_assignment (tree dst, tree src)
return list;
}
+ /* fold_build3 (BIT_FIELD_REF, ...) sometimes returns a cast. */
+ if (CONVERT_EXPR_P (dst))
+ {
+ STRIP_NOPS (dst);
+ src = fold_convert (TREE_TYPE (dst), src);
+ }
/* It was hoped that we could perform some type sanity checking
here, but since front-ends can emit accesses of fields in types
different from their nominal types and copy structures containing
@@ -2316,8 +2325,8 @@ sra_build_assignment (tree dst, tree src)
So we just assume type differences at this point are ok.
The only exception we make here are pointer types, which can be different
in e.g. structurally equal, but non-identical RECORD_TYPEs. */
- if (POINTER_TYPE_P (TREE_TYPE (dst))
- && !useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (src)))
+ else if (POINTER_TYPE_P (TREE_TYPE (dst))
+ && !useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (src)))
src = fold_convert (TREE_TYPE (dst), src);
return build_gimple_modify_stmt (dst, src);