diff options
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 14 |
2 files changed, 15 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b0f0ef3c66..09e8deec648 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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> diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 99b8f2a1e9d..448e2752259 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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); |