A fix is available
APAR status
Closed as program error.
Error description
Consider the following testcase: /***************** test.c **************************/ #include "stdlib.h" #include "stdio.h" #define DLEN 1024 typedef struct { vector4double c1, c2, c3; } s12_t; s12_t gs; double gd[DLEN]; void init_gd() { int i; double d=1.0; for(i=0; i<DLEN; i++) { gd[i] = d; d += .001; } } void show_s12v(char* str, s12_t v) { printf("%s: c1[0] ... = %f %f %f %f\n", str, v.c1[0], v.c1[1], v.c1[2], v.c1[3]); printf("%s: c2[0] ... = %f %f %f %f\n", str, v.c2[0], v.c2[1], v.c2[2], v.c2[3]); printf("%s: c3[0] ... = %f %f %f %f\n", str, v.c3[0], v.c3[1], v.c3[2], v.c3[3]); } int main(void){ double *p; init_gd(); p = gd; /* Show original values */ printf("gd[0] ... = %f %f %f %f\n",gd[0], gd[1], gd[2], gd[3]); printf("gd[4] ... = %f %f %f %f\n",gd[4], gd[5], gd[6], gd[7]); printf("gd[8] ... = %f %f %f %f\n",gd[8], gd[9], gd[10], gd[11]); /* Assign gs */ gs.c1 = vec_ld(0L, &gd[0]); gs.c2 = vec_ld(0L, &gd[4]); gs.c3 = vec_ld(0L, &gd[8]); /* Show gs */ p=(double*)&gs; printf("gs.c1[0] ... = %f %f %f %f\n",p[0], p[1], p[2], p[3]) printf("gs.c2[0] ... = %f %f %f %f\n",p[4], p[5], p[6], p[7]) printf("gs.c3[0] ... = %f %f %f %f\n",p[8], p[9], p[10], p[11]); /* Pass gs by value */ show_s12v("gs passed by val",gs); return 0; } /************** end of test.c **************************/ Build the testcase binary using the command: mpixlc -qstrict -qarch=qp -qtune=qp test.c Compiler displays incorrect values of the elements of structure of quad vector literal vector4double's data type passed by value: gd[0] ... = 1.000000 1.001000 1.002000 1.003000 gd[4] ... = 1.004000 1.005000 1.006000 1.007000 gd[8] ... = 1.008000 1.009000 1.010000 1.011000 gs.c1[0] ... = 1.000000 1.001000 1.002000 1.003000 gs.c2[0] ... = 1.004000 1.005000 1.006000 1.007000 gs.c3[0] ... = 1.008000 1.009000 1.010000 1.011000 gs passed by val: c1[0] ... = 1.003000 1.004000 1.005000 1.011000 gs passed by val: c2[0] ... = 0.000000 0.000000 0.000000 1.006000 gs passed by val: c3[0] ... = 1.007000 1.008000 1.009000 1.010000 LOCAL FIX: N/A
Local fix
N/A
Problem summary
aggregates containing vectors not correctly passed by value
Problem conclusion
There were 2 problems. Aggregates are passed in gprs. The called procedure was incorrect in determining the starting register when the extra alignment requirements of vector needed to be taken into account. The alignment also needed to be taken into account when determining the location on the stack of the parameter structure.
Temporary fix
Comments
APAR Information
APAR number
LI77244
Reported component name
XL C/C++ FOR BG
Reported component ID
5799AG100
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2013-02-22
Closed date
2013-05-29
Last modified date
2013-05-29
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C/C++ FOR BG
Fixed component ID
5799AG100
Applicable component levels
RC10 PSY
UP
Rate this page:
Average rating
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.