[Bug c++/49039] [4.6/4.7 Regression] LLVM StringRef miscompilation with -O2

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 18 17:29:00 GMT 2011


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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-18 16:55:20 UTC ---
Shorter testcase:

/* PR tree-optimization/49039 */
extern void abort (void);
int cnt;

__attribute__((noinline, noclone)) void
foo (unsigned int x, unsigned int y)
{
  unsigned int minv, maxv;
  if (x == 0 || y == -1U)
    return;
  minv = x < y ? x : y;
  maxv = x > y ? x : y;
  if (minv == 0)
    ++cnt;
  if (maxv == -1U)
    ++cnt;
}

int
main ()
{
  foo (-1U, 0);
  if (cnt != 2)
    abort ();
  return 0;
}



More information about the Gcc-bugs mailing list