Fixes are available
APAR status
Closed as program error.
Error description
A pointer dereference in a conditional IF statement found in a loop is causing bad output when compiling with a specific sequence of compile options: -g8 -O4 -qnoipa . === TEST CASE === #include <stdio.h> int main() { int idx = -1, min, i; int acol[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int *p; min = 0x7fffffff; for(i = 0, p = acol; i < 10; i++, p++) { if (*p < min) { idx = i; min = *p; } } printf("min at index %d\n", idx); } $ xlc -g8 -O4 -qnoipa test.c $ ./a.out min at index 10 $ Expected Output: min at index 0
Local fix
Add the -qnohot option to the end of the compiler option list.
Problem summary
PROBLEM DESCRIPTION: Compiler optimization iterates over the array, but then continues past the limit of the array. Cause is a false minimum value coming from accessing indexes outside of the array. USERS AFFECTED: Users of high optimization level, -qipa or -qhot
Problem conclusion
The optimization was corrected.
Temporary fix
Comments
APAR Information
APAR number
IJ04416
Reported component name
XL C FOR AIX
Reported component ID
5725C7100
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2018-03-01
Closed date
2018-03-01
Last modified date
2018-03-01
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 FOR AIX
Fixed component ID
5725C7100
Applicable component levels
RD10 PSY
[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1"}]
Document Information
Modified date:
14 September 2021