This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/42614] [4.4 Regression] FRE optimizes away valid code after IPA inlining



------- Comment #7 from rguenth at gcc dot gnu dot org  2010-01-05 11:57 -------
Shorter testcase, fails at -O2 -fno-early-inlining:

extern void abort(void);

typedef struct SEntry
{
  int num;
} TEntry;

typedef struct STable
{
  TEntry data[2];
} TTable;

TTable * __attribute__((noinline))
init ()
{
  static TTable t;
  return &t;
}

static inline void
inlined_wrong (TEntry *entry_p)
{
  unsigned char index;
  entry_p->num = 0;

  for (index = 0; index < 1; index++)
    entry_p->num++;

  if (!entry_p->num)
    abort();
}

void __attribute__((noinline))
expect_func (unsigned char *b)
{
  if (!b)
    abort ();
}

int
main ()
{
  unsigned char index = 0;
  TTable *table_p;

  expect_func (&index);

  table_p = init();
  inlined_wrong (&(table_p->data[1]));

  return 0;
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42614


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