A fix is available
APAR status
Closed as program error.
Error description
The following test case (3 source files) have application runtime segmentation fault if the program is compiled on AIX5.3 with -O -Q. Removing -Q compiles and runs fine. xlc -O -Q -c bug.c -o bug_inline.o xlc -O -Q -c main.c -o main_inline.o xlc -O -Q bug_inline.o main_inline.o -o bug_inline ./bug_inline (segmentation fault) ===== TESTCASE: /*******$ cat bug.h*******/ typedef struct { int x; } SYMBOL; /*********$ cat bug.c*******/ #include <stddef.h> #include <stdlib.h> #include "bug.h" //Workaround: __attribute__((noinline)) int allocate(SYMBOL **symbol) { SYMBOL *temp_symbol; if ((temp_symbol = malloc(sizeof(SYMBOL))) == NULL) return -1; temp_symbol->x = 1; *symbol = temp_symbol; return 0; } void create(SYMBOL **symptr) { if (allocate(symptr)) return; (*symptr)->x = 1; } void create(SYMBOL **symptr); /*********$ cat main.c*********/ #include "bug.h" int main() { SYMBOL *sym; create(&sym); return 0; }
Local fix
1) Removing -Q on compile line on AIX 5.3. 2) Compiling with -O -Q on AIX6.1. 3) Combining the 3 source files into one file and compiliing with -O -Q on AIX 5.3. 4) Adding __attribute__((noinline))to int allocate(SYMBOL **symbol) in bug.c.
Problem summary
PROBLEM DESCRIPTION: Memory corruption due to bad load/store swap. USERS AFFECTED: Programs using inlining with multiple levels of indirection for an argument to a function, some combination of pointers for the associated parameter in the function body for the compiler to generate a sequence of Pointer Aliasing directves which does not work out when using inlining.
Problem conclusion
Fixed a corner case in Intermediate Language generation which affects how the Inliner patches arguments to parameters.
Temporary fix
Comments
APAR Information
APAR number
LI76007
Reported component name
XL C/C++ SLES10
Reported component ID
5724S7300
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-02-23
Closed date
2011-02-23
Last modified date
2011-02-23
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++ SLES10
Fixed component ID
5724S7300
Applicable component levels
R900 PSN IZ71859
UP06/09/13
[{"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