Fixes are available
APAR status
Closed as program error.
Error description
Incorrect storage to a struct member is seen when an operator- is inlined. The store offset into the struct is incorrect when using an array initialization with constructed elements. In the example below: T v[1] = { { 7, d - 2 } }; // THE STORAGE OF THE 'd - 2' // RESULT INTO THE NEW D OBJECT // HAS WRONG OFFSET === TEST CASE === #include <stdio.h> struct D { int d; D(int s) : d(s) { printf("D(%d)\n",s); } }; inline D operator-(const D &d, int n) { printf("D op-(%d,%d)=%d\n",d.d,n,d.d-n); return D(d.d - n); } struct T { int v; D d; }; void verify(const T &t) { printf("t={%d,{%d}} : ", t.v, t.d.d); printf("%s\n", t.v == 7 && t.d.d==3 ? "Good" : "Bad"); } int main() { D d(5); T v[1] = { { 7, d - 2 } }; verify(v[0]); } $ xlC -qinline test.cpp $ ./a.out D(5) D op-(5,2)=3 D(3) t={3,{146}} : Bad $
Local fix
- Do not use -qinline - Prevent inlining via the __attribute__ ((noinline)) function attribute
Problem summary
USERS AFFECTED: The problem may be exposed when an array of class type is initialized with a bracelist initializer when the constructor call for a member of the class is inlined. PROBLEM DESCRIPTION: The inlined code exposed a problem with code generation that incorrectly specified indexes and offsets for the array members.
Problem conclusion
The problem has been resolved.
Temporary fix
Comments
APAR Information
APAR number
IV97596
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2017-06-29
Closed date
2017-06-29
Last modified date
2017-06-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 AI
Fixed component ID
5725C7200
Applicable component levels
[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1","Edition":"","Line of Business":{"code":"LOB73","label":"Power TPS"}}]
Document Information
Modified date:
19 August 2024