Fixes are available
APAR status
Closed as program error.
Error description
A segmentation fault is encountered at -O3 optimization whe runnning a test case that contains a nested loop. ==== Test case: test.c: #include <stdlib.h> #include <stdio.h> typedef struct { void *params; } Temp; void * get_params(Lattice *lat) { return lat->params; } void get_loop(Temp *lat, int x[], int nd, int index) { void *p = get_params(lat); for(int i=0; i<nd; i++) { x[i] = index; } } void CreateNestedBlock(int nd, Lattice *lat) { for(int b=0; b<2; b++) { int xf[nd]; for(int j=0; j<1; j++) { get_loop(lat, xf, nd, j); } } } int main(int argc, char *argv[]) { int ndim = 4; Temp lat; lat.params = NULL; printf("starting\n"); CreateNestedBlock(ndim, &lat); printf("done\n"); return 0; } ==== Observed Output: $ xlc -O3 test.c staring Segmentation fault $
Local fix
Use a lower optimization level.
Problem summary
PROBLEM DESCRIPTION: Segmentation fault at -O3 when returning from a function. USERS AFFECTED: Users of optimization levels -O3 or higher.
Problem conclusion
Intermediate generated code was incorrectly moved outside of an internal optimized loop. Resulting in the corruption of the return address of the function. This fix involves ensuring that this particular block of code is not moved outside of the loop.
Temporary fix
Comments
APAR Information
APAR number
LI76071
Reported component name
XL C/C++ AE BG/
Reported component ID
5799HJE00
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-04-11
Closed date
2011-07-26
Last modified date
2011-07-26
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
LI76226 LI76248 IV02163 IV03155 LI76292 IV05137 LI76394 LI76410
Fix information
Fixed component name
XL C/C++ AE BG/
Fixed component ID
5799HJE00
Applicable component levels
R900 PSY
UP
[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
17 October 2021