diff options
author | Steven Bosscher <stevenb@suse.de> | 2005-01-27 00:58:11 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2005-01-27 00:58:11 +0000 |
commit | c006df4eecdd0b1abbaca7728893d3729df10e65 (patch) | |
tree | 4960857b959a431ea43e5af1b1a42bcea50d741c /gcc/fortran/trans-decl.c | |
parent | 2f0a3aa2db103da5125827aad01c97359c62b81e (diff) | |
download | gcc-c006df4eecdd0b1abbaca7728893d3729df10e65.zip gcc-c006df4eecdd0b1abbaca7728893d3729df10e65.tar.gz gcc-c006df4eecdd0b1abbaca7728893d3729df10e65.tar.bz2 |
trans-decl.c (gfc_build_label_decl): Set DECL_ARTIFICAL and TREE_USED for all labels.
* trans-decl.c (gfc_build_label_decl): Set DECL_ARTIFICAL and
TREE_USED for all labels.
(gfc_trans_entry_master_switch): Use it instead of building a
label by hand.
* trans-io.c (add_case): Likewise.
* trans-stmt.c (gfc_trans_integer_select): Likewise.
From-SVN: r94299
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 65ba867..6567695 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -148,9 +148,9 @@ gfc_add_decl_to_function (tree decl) } -/* Build a backend label declaration. - Set TREE_USED for named lables. For artificial labels it's up to the - caller to mark the label as used. */ +/* Build a backend label declaration. Set TREE_USED for named labels. + The context of the label is always the current_function_decl. All + labels are marked artificial. */ tree gfc_build_label_decl (tree label_id) @@ -174,19 +174,13 @@ gfc_build_label_decl (tree label_id) DECL_CONTEXT (label_decl) = current_function_decl; DECL_MODE (label_decl) = VOIDmode; - if (label_name) - { - DECL_ARTIFICIAL (label_decl) = 1; - } - else - { - /* We always define the label as used, even if the original source - file never references the label. We don't want all kinds of - spurious warnings for old-style Fortran code with too many - labels. */ - TREE_USED (label_decl) = 1; - } + /* We always define the label as used, even if the original source + file never references the label. We don't want all kinds of + spurious warnings for old-style Fortran code with too many + labels. */ + TREE_USED (label_decl) = 1; + DECL_ARTIFICIAL (label_decl) = 1; return label_decl; } @@ -2122,16 +2116,13 @@ gfc_trans_entry_master_switch (gfc_entry_list * el) for (; el; el = el->next) { /* Add the case label. */ - label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE); - DECL_CONTEXT (label) = current_function_decl; + label = gfc_build_label_decl (NULL_TREE); val = build_int_cst (gfc_array_index_type, el->id); tmp = build3_v (CASE_LABEL_EXPR, val, NULL_TREE, label); gfc_add_expr_to_block (&block, tmp); /* And jump to the actual entry point. */ label = gfc_build_label_decl (NULL_TREE); - TREE_USED (label) = 1; - DECL_CONTEXT (label) = current_function_decl; tmp = build1_v (GOTO_EXPR, label); gfc_add_expr_to_block (&block, tmp); |