diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 09:04:44 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 09:04:44 +0000 |
commit | f5ec85fb0dbe2a6f726a6c7d783f7d146e5adaee (patch) | |
tree | 59850848c5abef9945446e189f590380583debc0 /gcc/tree-cfg.c | |
parent | e66cf25afd90e4d88ba70bd67b58c40b5293db8f (diff) | |
download | gcc-f5ec85fb0dbe2a6f726a6c7d783f7d146e5adaee.tar.gz |
2010-07-05 Richard Guenther <rguenther@suse.de>
* 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
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 14 |
1 files changed, 8 insertions, 6 deletions
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); |