aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-12-18 08:52:07 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2008-12-18 08:52:07 +0100
commit9f68560cb5dd86f27ed0df035cc4821b39885887 (patch)
tree91fd1cf626b84fa232d2aee6cfc4d4636ae95b43 /gcc/tree-ssa.c
parent18430d277c64c6a61a818890fd6a7be69f288ae8 (diff)
downloadgcc-9f68560cb5dd86f27ed0df035cc4821b39885887.zip
gcc-9f68560cb5dd86f27ed0df035cc4821b39885887.tar.gz
gcc-9f68560cb5dd86f27ed0df035cc4821b39885887.tar.bz2
re PR middle-end/38505 (Revision 142061 caused ICE on __builtin_memcpy)
PR middle-end/38505 * tree-ssa.c (useless_type_conversion_p_1): Return false if inner_type is incomplete and outer_type is complete. * gcc.c-torture/compile/pr38505.c: New test. From-SVN: r142806
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r--gcc/tree-ssa.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 935cad6..ce0f1e4 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1188,6 +1188,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
return false;
+ /* Conversion from an incomplete to a complete type is never
+ useless. */
+ if (!COMPLETE_TYPE_P (inner_type) && COMPLETE_TYPE_P (outer_type))
+ return false;
+
/* ??? This seems to be necessary even for aggregates that don't
have TYPE_STRUCTURAL_EQUALITY_P set. */