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: --disable-checking bootstrap failure


On Mon, Sep 13, 2004 at 08:35:26AM -0400, Diego Novillo wrote:
> On Fri, 2004-09-10 at 12:24, Nathan Sidwell wrote:
> 
> > It's getting to the end of the day here, and I'm going to have another
> > learning curve figuring out where to look next.  anyone want to help?
> > 
> I'm looking at this failure today.  Have any other details?

I ran into one of the reported symptoms overnight and reduced it.  The
attached is a testcase reduced from tree-cfg.c.  When built using
stage1, or a bootstrapped --enable-checking compiler, it reduces to an
infinite loop.  It appears that the compiler decides that tsi_next does
not change the result value of bsi_stmt.

Compile like so on i686-pc-linux-gnu:
stage1/xgcc -Bstage1/ -c -g -O2 -w tree-cfg2.c -o tmp-tree-cfg.o

-- 
Daniel Jacobowitz
union tree_node;
typedef union tree_node *tree;

enum tree_code { LABEL_EXPR, RETURN_EXPR };
 
struct tree_statement_list_node
{
  struct tree_statement_list_node *prev;
  struct tree_statement_list_node *next;
  tree stmt;
};

union tree_node
{
  struct {
    int code;
  } common;
  struct {
    int code;
    tree head, tail;
  } stmt_list;
};

struct basic_block_def
{
  int index;
  tree stmt_list;
  struct edge_def *succ;
};

typedef struct basic_block_def *basic_block;

struct edge_def
{
  int flags;
  struct edge_def *pred_next;
  struct edge_def *succ_next;


  struct basic_block_def *src;
  struct basic_block_def *dest;
};
typedef struct edge_def *edge;

extern basic_block ENTRY_BLOCK_PTR;



typedef struct {
  struct tree_statement_list_node *ptr;
  tree container;
} tree_stmt_iterator;

typedef struct {
  tree_stmt_iterator tsi;
  basic_block bb;
} block_stmt_iterator;

static __inline__ tree_stmt_iterator
tsi_start (tree t)
{
  tree_stmt_iterator i;

  i.ptr = ((t)->stmt_list.head);
  i.container = t;

  return i;
}

static __inline__ tree_stmt_iterator
tsi_last (tree t)
{
  tree_stmt_iterator i;

  i.ptr = ((t)->stmt_list.tail);
  i.container = t;

  return i;
}

static __inline__ unsigned char
tsi_end_p (tree_stmt_iterator i)
{
  return i.ptr == ((void *)0);
}

static __inline__ unsigned char
tsi_one_before_end_p (tree_stmt_iterator i)
{
  return i.ptr != ((void *)0) && i.ptr->next == ((void *)0);
}

static __inline__ void
tsi_next (tree_stmt_iterator *i)
{
  i->ptr = i->ptr->next;
}

static __inline__ void
tsi_prev (tree_stmt_iterator *i)
{
  i->ptr = i->ptr->prev;
}

static __inline__ tree *
tsi_stmt_ptr (tree_stmt_iterator i)
{
  return &i.ptr->stmt;
}

static __inline__ tree
tsi_stmt (tree_stmt_iterator i)
{
  return i.ptr->stmt;
}

static __inline__ block_stmt_iterator
bsi_start (basic_block bb)
{
  block_stmt_iterator bsi;
  if (bb->stmt_list)
    bsi.tsi = tsi_start (bb->stmt_list);
  else
    {
      ((void)(0 && (bb->index < 0)));
      bsi.tsi.ptr = ((void *)0);
      bsi.tsi.container = ((void *)0);
    }
  bsi.bb = bb;
  return bsi;
}

static __inline__ block_stmt_iterator
bsi_last (basic_block bb)
{
  block_stmt_iterator bsi;
  if (bb->stmt_list)
    bsi.tsi = tsi_last (bb->stmt_list);
  else
    {
      ((void)(0 && (bb->index < 0)));
      bsi.tsi.ptr = ((void *)0);
      bsi.tsi.container = ((void *)0);
    }
  bsi.bb = bb;
  return bsi;
}


static __inline__ void
bsi_next (block_stmt_iterator *i)
{
  tsi_next (&i->tsi);
}


static __inline__ tree
bsi_stmt (block_stmt_iterator i)
{
  return tsi_stmt (i.tsi);
}

unsigned char
tree_find_edge_insert_loc (edge e, block_stmt_iterator *bsi,
      basic_block *new_bb)
{
  basic_block dest, src;
  tree tmp;

  dest = e->dest;
 restart:
      *bsi = bsi_start (dest);


      tmp = bsi_stmt (*bsi);
      while (((enum tree_code) (tmp)->common.code) == LABEL_EXPR)
 {
   bsi_next (bsi);
   tmp = bsi_stmt (*bsi);
 }





  src = e->src;
  if ((e->flags & 2) == 0
      && src->succ->succ_next == ((void *)0)
      && src != ENTRY_BLOCK_PTR)
    {
      *bsi = bsi_last (src);

      tmp = bsi_stmt (*bsi);



      if (((enum tree_code) (tmp)->common.code) == RETURN_EXPR)
        {
   return 1;
        }
    }


}

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