Skip to content

Commit aaa7ac4

Browse files
committed
tree-optimization/122225 - fix return stmt verification
The following fixes return stmt type verification by properly looking at DECL_RESULT to decide whether that's by reference, not trying to figure that from the actual argument. PR tree-optimization/122225 * tree-cfg.cc (verify_gimple_return): Look at DECL_RESULT for DECL_BY_REFERENCE.
1 parent ef29eab commit aaa7ac4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

gcc/tree-cfg.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4786,6 +4786,7 @@ verify_gimple_return (greturn *stmt)
47864786
{
47874787
tree op = gimple_return_retval (stmt);
47884788
tree restype = TREE_TYPE (TREE_TYPE (cfun->decl));
4789+
tree resdecl = DECL_RESULT (cfun->decl);
47894790

47904791
/* We cannot test for present return values as we do not fix up missing
47914792
return values from the original source. */
@@ -4800,12 +4801,7 @@ verify_gimple_return (greturn *stmt)
48004801
return true;
48014802
}
48024803

4803-
if ((TREE_CODE (op) == RESULT_DECL
4804-
&& DECL_BY_REFERENCE (op))
4805-
|| (TREE_CODE (op) == SSA_NAME
4806-
&& SSA_NAME_VAR (op)
4807-
&& TREE_CODE (SSA_NAME_VAR (op)) == RESULT_DECL
4808-
&& DECL_BY_REFERENCE (SSA_NAME_VAR (op))))
4804+
if (resdecl && DECL_BY_REFERENCE (resdecl))
48094805
op = TREE_TYPE (op);
48104806

48114807
if (!useless_type_conversion_p (restype, TREE_TYPE (op)))

0 commit comments

Comments
 (0)