This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Missing code_label's


Hi there,

The following program causes a fatal signal in ``cached_make_edge''.

struct str
{
  int a;
};

extern void baz (struct str);

static inline int foo (int a)
{
  return a;
}

static inline int bar (int a)
{
  baz ( (struct str) { foo (a) } );
  return 0;
}

int fubar (int a)
{
  return bar (a);
}

The problem is that when ``expand_call'' emits the sequences for tail
recursion, tail call and normal call, a ``DECL_LABEL'' node is visited
several times, but its rtx is output only in one of the streams, so
other streams contain a ``jump_insn'', which jumps to a
``code_label'', which is not among the insns, so ``BLOCK_FOR_INSN''
returns null, etc, etc.

The attached patch makes each ``code_label'' rtx point back to the
``DECL_LABEL'' node. This link is used to remove the association
between the rtx and the tree (in the tree -> rtx direction), so
successive expands if ``DECL_LABEL'' emit insn in each call stream. It
can be used to create the association later, when we choose one of the
call sequences, though I haven't seen the need yet.

What do you think ? 

Regards,
-velco

PS. Ok, when a conlusion is reached for the right fix, I'll add change
logs, test case, etc.

Attachment: gcc-clear-labels.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]