re PR middle-end/24135 (nonlocal goto from nested function gets 'undefined symbol' in assembler)
PR 24135 * tree-nested.c (convert_nl_goto_reference): Lookup a translation before creating a new one. From-SVN: r104911
This commit is contained in:
parent
bb13c3502b
commit
1718a2aa9b
|
@ -1,3 +1,9 @@
|
||||||
|
2005-10-03 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
PR 24135
|
||||||
|
* tree-nested.c (convert_nl_goto_reference): Lookup a translation
|
||||||
|
before creating a new one.
|
||||||
|
|
||||||
2005-10-03 David Edelsohn <edelsohn@gnu.org>
|
2005-10-03 David Edelsohn <edelsohn@gnu.org>
|
||||||
|
|
||||||
* config/rs6000/t-aix43 (LDFLAGS): New.
|
* config/rs6000/t-aix43 (LDFLAGS): New.
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef NO_TRAMPOLINES
|
||||||
|
extern void abort (void);
|
||||||
|
|
||||||
|
int x(int a, int b)
|
||||||
|
{
|
||||||
|
__label__ xlab;
|
||||||
|
__label__ xlab2;
|
||||||
|
|
||||||
|
void y(int b)
|
||||||
|
{
|
||||||
|
switch (b)
|
||||||
|
{
|
||||||
|
case 1: goto xlab;
|
||||||
|
case 2: goto xlab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a = a + 2;
|
||||||
|
y (b);
|
||||||
|
|
||||||
|
xlab:
|
||||||
|
return a;
|
||||||
|
|
||||||
|
xlab2:
|
||||||
|
a++;
|
||||||
|
return a;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main ()
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (j = 1; j <= 2; ++j)
|
||||||
|
for (i = 1; i <= 2; ++i)
|
||||||
|
{
|
||||||
|
int a = x (j, i);
|
||||||
|
if (a != 2 + j)
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int main() { return 0; }
|
||||||
|
#endif
|
|
@ -1089,7 +1089,7 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
|
||||||
struct walk_stmt_info *wi = data;
|
struct walk_stmt_info *wi = data;
|
||||||
struct nesting_info *info = wi->info, *i;
|
struct nesting_info *info = wi->info, *i;
|
||||||
tree t = *tp, label, new_label, target_context, x, arg, field;
|
tree t = *tp, label, new_label, target_context, x, arg, field;
|
||||||
struct var_map_elt *elt;
|
struct var_map_elt *elt, dummy;
|
||||||
void **slot;
|
void **slot;
|
||||||
|
|
||||||
*walk_subtrees = 0;
|
*walk_subtrees = 0;
|
||||||
|
@ -1110,17 +1110,23 @@ convert_nl_goto_reference (tree *tp, int *walk_subtrees, void *data)
|
||||||
control transfer. This new label will be marked LABEL_NONLOCAL; this
|
control transfer. This new label will be marked LABEL_NONLOCAL; this
|
||||||
mark will trigger proper behavior in the cfg, as well as cause the
|
mark will trigger proper behavior in the cfg, as well as cause the
|
||||||
(hairy target-specific) non-local goto receiver code to be generated
|
(hairy target-specific) non-local goto receiver code to be generated
|
||||||
when we expand rtl. */
|
when we expand rtl. Enter this association into var_map so that we
|
||||||
new_label = create_artificial_label ();
|
can insert the new label into the IL during a second pass. */
|
||||||
DECL_NONLOCAL (new_label) = 1;
|
dummy.old = label;
|
||||||
|
slot = htab_find_slot (i->var_map, &dummy, INSERT);
|
||||||
|
elt = *slot;
|
||||||
|
if (elt == NULL)
|
||||||
|
{
|
||||||
|
new_label = create_artificial_label ();
|
||||||
|
DECL_NONLOCAL (new_label) = 1;
|
||||||
|
|
||||||
/* Enter this association into var_map so that we can insert the new
|
elt = ggc_alloc (sizeof (*elt));
|
||||||
label into the IL during a second pass. */
|
elt->old = label;
|
||||||
elt = ggc_alloc (sizeof (*elt));
|
elt->new = new_label;
|
||||||
elt->old = label;
|
*slot = elt;
|
||||||
elt->new = new_label;
|
}
|
||||||
slot = htab_find_slot (i->var_map, elt, INSERT);
|
else
|
||||||
*slot = elt;
|
new_label = elt->new;
|
||||||
|
|
||||||
/* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */
|
/* Build: __builtin_nl_goto(new_label, &chain->nl_goto_field). */
|
||||||
field = get_nl_goto_field (i);
|
field = get_nl_goto_field (i);
|
||||||
|
|
Loading…
Reference in New Issue