This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR c/9262
> Looks like we're on the right track. But your patch appears to chain
> just the first case label to the SWITCH_BODY; further labels continue
> to be chained after the SWITCH_STMT.
No, subsequent statements and labels are chained to the tree chain starting
with TREE_CHAIN (first_case_label).
> And I don't understand your change to c_finish_case at all.
The RECHAIN_STMTS macro reads:
/* LAST_TREE contains the last statement parsed. These are chained
together through the TREE_CHAIN field, but often need to be
re-organized since the parse is performed bottom-up. This macro
makes LAST_TREE the indicated SUBSTMT of STMT. */
#define RECHAIN_STMTS(stmt, substmt) \
do { \
substmt = TREE_CHAIN (stmt); \
TREE_CHAIN (stmt) = NULL_TREE; \
last_tree = stmt; \
} while (0)
I split the macro into two parts:
- the first 2 lines were moved to do_case() in order to rechain the labels on
the first label addition instead of at the end of the switch statement,
- the third line is necessary at the end of the switch statement because
subsequent statements need to be chained to the SWITCH_STMT, not to the tree
chain pointed to by SWITCH_BODY.
--
Eric Botcazou