[Bug c/47947] New: Varibles of type vector double are not copied correctly in gcc-4.5.1 and gcc-4.6.0

2011-03-01 Thread tkarkha at us dot ibm.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47947

   Summary: Varibles of type vector double are not copied
correctly in gcc-4.5.1 and gcc-4.6.0
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: tkar...@us.ibm.com
CC: meiss...@linux.vnet.ibm.com


Created attachment 23505
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23505
Tarfile for recreating the bug

When copying one vector double variable to another vector double variable, for
some variables the lower half of the variable is zeroed out.  The zeroing
results in incorrect computations.  This happens for all -O optimization
levels.

A small testcase is provided to recreate the bug.  In the testcase a simple
vector addition with vec_add() results in an incorrect result due to incorrect
copy.  Here is the ouptut from the testcase:
$ ./gccBugTest_GCC   
DEBUG:: u_in0 = <1.00,2.00,3.00,4.00>
DEBUG:: u_in1 = <5.00,6.00,7.00,8.00>
DEBUG::foo:: l_temp0 = <1.00,2.00,3.00,4.00>
DEBUG::foo:: l_temp1 = <5.00,6.00,7.00,8.00>
DEBUG::foo:: in0 HI = <1.00,0.00>
DEBUG::foo:: in0 LO = <3.00,0.00>
DEBUG::foo:: in1 HI = <5.00,0.00>
DEBUG::foo:: in1 LO = <7.00,0.00>
DEBUG::foo:: l_result HI = <6.00,0.00>
DEBUG::foo:: l_result LO = <10.00,12.00>
DEBUG::foo:: result:: l_temp2 = <6.00,0.00,10.00,12.00>
DEBUG:: u_out = <6.00,0.00,10.00,12.00>
$ 

The last DEBUG line should be DEBUG:: u_out =
<6.00,8.00,10.00,12.00>
  


[Bug target/47947] Varibles of type vector double are not copied correctly in gcc-4.5.1 and gcc-4.6.0

2011-03-02 Thread tkarkha at us dot ibm.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47947

--- Comment #4 from Tejas Karkhanis  2011-03-02 
22:35:01 UTC ---
David,

I tried building with -maix64 flag.  Here is the output after compiling with
-maix64 flag:

gcc-4.6.0 -Wall -O3 -I ./ -std=gnu99 -maltivec -mabi=altivec
-flax-vector-conversions -mvsx -mcpu=power7 -mtune=power7 -maix64 gccBugTest.c
-o gccBugTest_GCC
$ ./gccBugTest_GCC
DEBUG:: u_in0 = <1.00,2.00,3.00,4.00>
DEBUG:: u_in1 = <5.00,6.00,7.00,8.00>
DEBUG::foo:: l_temp0 = <1.00,2.00,3.00,4.00>
DEBUG::foo:: l_temp1 = <5.00,6.00,7.00,8.00>
DEBUG::foo:: in0 HI = <1.00,0.00>
DEBUG::foo:: in0 LO = <3.00,0.00>
DEBUG::foo:: in1 HI = <5.00,0.00>
DEBUG::foo:: in1 LO = <7.00,0.00>
DEBUG::foo:: l_result HI = <6.00,8.00>
DEBUG::foo:: l_result LO = <10.00,0.00>
DEBUG::foo:: result:: l_temp2 = <6.00,8.00,10.00,0.00>
DEBUG:: u_out = <6.00,8.00,10.00,0.00>
$ 

Notice that this time the error is in the right-most element of the variable
u_out -- the right-most element should have been 12.00.