vector bug?

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

 



Hi, I'm using gcc 3.4.0 20040305, on a pentium 4 red
hat system.  I'm trying to use the vector extensions. 
When I compile the following code with -O0 or -O1, it
does as I expect (it prints whatever was input plus
{1,2,3,4}.  When I compile with -O2 or -O3 on the
other hand, it prints garbage.  From the disassembly,
it is apparent that it is just not putting the right
arguments on the stack for the printf call.  Is my
code incorrect, or is this an optimization bug?

#include <stdio.h>

int main() {
  typedef int v4si __attribute__ ((mode(V4SI)));
  
  int vals[4];
  int ins[4];

  scanf("%d %d %d %d", &ins[0], &ins[1], &ins[2],
&ins[3]);
  v4si a = *(v4si*)ins, b = {1, 2, 3, 4}, c;

  c = a + b;
  *(v4si*)vals = c;
  printf("%d %d %d %d\n", vals[0], vals[1], vals[2],
vals[3]);
}


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux