This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Naked _DECL nodes in inlined functions
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 02 May 2003 08:48:00 -0600
- Subject: [tree-ssa] Naked _DECL nodes in inlined functions
- Reply-to: law at redhat dot com
While working on the crud zapper (is that anything like a tele-zapper? :-)
I ran into another case of naked _DECL nodes in the tree structures. This
is verboten and can potentially cause mis-compilations. This happens
when the NRV optimization is performed on a function, which is later
integrated into another function. Whee fun.
* tree-inline.c (expand_call_inline): Avoid creating naked
_DECL nodes for inlined functions which had NRV optimizations
applied.
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.27
diff -c -3 -p -r1.26.2.27 tree-inline.c
*** tree-inline.c 1 May 2003 16:50:21 -0000 1.26.2.27
--- tree-inline.c 2 May 2003 14:44:34 -0000
*************** expand_call_inline (tp, walk_subtrees, d
*** 1079,1085 ****
/* Finally, mention the returned value so that the value of the
statement-expression is the returned value of the function. */
! if (retvar)
BIND_EXPR_BODY (expr)
= add_stmt_to_compound (BIND_EXPR_BODY (expr),
TREE_TYPE (retvar), retvar);
--- 1079,1085 ----
/* Finally, mention the returned value so that the value of the
statement-expression is the returned value of the function. */
! if (retvar && TREE_TYPE (expr) != void_type_node)
BIND_EXPR_BODY (expr)
= add_stmt_to_compound (BIND_EXPR_BODY (expr),
TREE_TYPE (retvar), retvar);