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]

Re: [RFC] tree-cfg.c: Check that a nonlocal label doesn't appearin the middle of a basic block.


Hi Jeff,

> Which is (I think) the key question.

So here is what's going on with gcc.c-torture/compile/20021108-1.c.

Here is the dump before the very first call to
delete_unreachable_blocks.

main ()
{
  void l2 = <<< error >>>;
  void l1 = <<< error >>>;
  int l2.1;
  int l1.0;
  int D.1120;

l1: [forced];
  l1.0 = (int) &l1;
  l2.1 = (int) &l2;
  D.1120 = l1.0 - l2.1;
  goto <bb 2> (<L2>);

l2: [forced];           <- unreachable in CFG sense
  return;

<L2>:;
  return D.1120;

}

Here is the dump after the very first call to
delete_unreachable_blocks, which turns out to be invalid according to
my patched version of tree_verify_flow_info that uses
stmt_starts_bb_p.  l2 was moved to the beginning of the first basic
block by remove_bb.

main ()
{
  void l2 = <<< error >>>;
  void l1 = <<< error >>>;
  int l2.1;
  int l1.0;
  int D.1120;

l2: [forced];           <- moved here.
l1: [forced];
  l1.0 = (int) &l1;
  l2.1 = (int) &l2;
  D.1120 = l1.0 - l2.1;

<L2>:;
  return D.1120;

}

[forced] above indicates a FORCED_LABEL.

So here are design questions.

Shall we disallow removal of a basic block with a forced label even if
it appears to be unreachable in CFG sense?

Shall we split the first basic block into two pieces, one with "l2" by
itself and the rest?

Shall we allow multiple forced labels at one basic block?

Note that we are not talking about nonlocal labels.

Here are some related threads:

http://gcc.gnu.org/ml/gcc-patches/2004-10/msg00246.html
http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01143.html

Kazu Hirata


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