2010-07-05 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Jul 2010 09:04:44 +0000 (09:04 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Jul 2010 09:04:44 +0000 (09:04 +0000)
* tree-cfg.c (verify_gimple_return): Handle DECL_BY_REFERENCE
RESULT_DECLs properly.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161821 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-cfg.c

index 2b0f0ef..09e8dee 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-05  Richard Guenther  <rguenther@suse.de>
+
+       * tree-cfg.c (verify_gimple_return): Handle DECL_BY_REFERENCE
+       RESULT_DECLs properly.
+
 2010-07-04  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR rtl-optimization/44695
@@ -15,8 +20,8 @@
 
 2010-07-04  Jan Hubicka  <jh@suse.cz>
 
-        * cgraphunit.c (init_cgraph): Only initialize dump file if it is not already
-        initialized.
+        * cgraphunit.c (init_cgraph): Only initialize dump file if it is not
+       already initialized.
 
 2010-07-04  Richard Sandiford  <rdsandiford@googlemail.com>
 
index 99b8f2a..448e275 100644 (file)
@@ -3826,12 +3826,14 @@ verify_gimple_return (gimple stmt)
       return true;
     }
 
-  if (!useless_type_conversion_p (restype, TREE_TYPE (op))
-      /* ???  With C++ we can have the situation that the result
-        decl is a reference type while the return type is an aggregate.  */
-      && !(TREE_CODE (op) == RESULT_DECL
-          && TREE_CODE (TREE_TYPE (op)) == REFERENCE_TYPE
-          && useless_type_conversion_p (restype, TREE_TYPE (TREE_TYPE (op)))))
+  if ((TREE_CODE (op) == RESULT_DECL
+       && DECL_BY_REFERENCE (op))
+      || (TREE_CODE (op) == SSA_NAME
+         && TREE_CODE (SSA_NAME_VAR (op)) == RESULT_DECL
+         && DECL_BY_REFERENCE (SSA_NAME_VAR (op))))
+    op = TREE_TYPE (op);
+
+  if (!useless_type_conversion_p (restype, TREE_TYPE (op)))
     {
       error ("invalid conversion in return statement");
       debug_generic_stmt (restype);