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: gcc.c-torture/execute/va-arg-24.c



On Friday, October 10, 2003, at 07:37 AM, Richard Earnshaw wrote:



This test is bogus. How can the vector {14,15,16,17} ever compare equal
to the vector {20,21,22,23} ?

Ugh. There's another typo. The answer to your question is "easily, if you are comparing 1 byte from them".


I'll make a corrected testcase.

#include <stdarg.h>

#define vector __attribute__((vector_size(16)))

const vector unsigned int v1 = {10,11,12,13};
const vector unsigned int v2 = {20,21,22,23};

void foo(int a, ...)
{
  va_list args;
  vector unsigned int v;

  va_start (args, a);
  v = va_arg (args, vector unsigned int);
  if (a != 1 || memcmp (&v, &v1, sizeof (v)) != 0)
    abort ();
  a = va_arg (args, int);
  if (a != 2)
    abort ();
  v = va_arg (args, vector unsigned int);
  if (memcmp (&v, &v2, sizeof (v) != 0))
    abort ();
  va_end (args);
}

int main(void)
{
  foo (1, (vector unsigned int){10,11,12,13}, 2,
       (vector unsigned int){14,15,16,17});
  return 0;
}






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