[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug target/42542] Vectorizer produces incorrect results on max of signed intergers




------- Comment #7 from hjl dot tools at gmail dot com  2009-12-29 21:40 -------
Here is a testcase in C:

[hjl@gnu-6 tmp]$ cat y.c
unsigned int foo[] __attribute__ ((aligned(16))) =
{
  0x80000000, 1, 0xa0000000, 2,
  3, 0xd0000000, 0xf0000000, 0xe0000000
};
unsigned int bar[] __attribute__ ((aligned(16))) =
{
  4, 0xb0000000, 5, 0xc0000000,
  0xd0000000, 6, 7, 8
};

unsigned int val[] =
{
  0x80000000, 0xb0000000, 0xa0000000, 0xc0000000,
  0xd0000000, 0xd0000000, 0xf0000000, 0xe0000000
};

extern void abort ();

void
xxxx ()
{
  int i;

  for (i = 0; i < 8; i++)
    foo[i] = foo[i] < bar [i] ? bar [i] : foo[i];
}

int
main ()
{
  int i;

  xxxx ();
  for (i = 0; i < 8; i++)
    if (val[i] != foo[i])
      abort ();

  return 0;
}
[hjl@gnu-6 tmp]$ gcc /tmp/y.c -O2 -ftree-vectorize
[hjl@gnu-6 tmp]$ ./a.out 
Aborted (core dumped)
[hjl@gnu-6 tmp]$ 


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |x86
            Summary|g++ "-O -ftree-vectorize"   |Vectorizer produces
                   |produces incorrect results  |incorrect results on max of
                   |for less-than operator      |signed intergers


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

------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.


Reply to: