diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-08 16:34:37 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-08 16:34:37 +0000 |
commit | dd384a24339b3c05d5851f55bc3f9fb18fb01b80 (patch) | |
tree | a8975fb9c41eb56aa01f13bb3de2d9eef818b190 /gcc/tree-sra.c | |
parent | f6c33c78e5e0d4c5582c1936c3346b9916b6490a (diff) | |
download | gcc-dd384a24339b3c05d5851f55bc3f9fb18fb01b80.tar.gz |
* tree-sra.c (sra_build_assignment): Handle CONVERT_EXPR_P
dst.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137633 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index c50c6cd225b..16f719e5ecb 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); |