Fixes are available
November 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
July 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
December 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2012 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
January 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
May 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
August 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
APAR status
Closed as program error.
Error description
The issue comes from compiling a project that uses implicit and explicit instantiations of a template with the -qtemplateregistry option. When compiled twice, the template registry may register an incorrect record, thus causing an extra recompile, or in some cases, an unending loop of compilation. ===== TEST CASE ===== The scenario is: file A has an implicit instantiation of foo<int> file B has an explicit instantiation of foo<int> file C has an implicit instantiation of foo<int> compile in the following order: file A file B file C recompile file A To reproduce - Build this project twice: all: xlC_r -qtemplateregistry -I. -c -o filea.o filea.cpp xlC_r -qtemplateregistry -I. -c -o fileb.o fileb.cpp xlC_r -qtemplateregistry -I. -c -o filec.o filec.cpp xlC_r -qmkshrobj -qtemplateregistry -I. -o libTest.so filea.o fileb.o filec.o -------- filea.cpp -------- #include "temp.h" void filea() { mytemplate<int> asdf (5); int temp = asdf.getfoo(); } -------- fileb.cpp -------- #include "temp.h" template class mytemplate<int>; void fileb() { mytemplate<int> asdf (5); } -------- filec.cpp -------- #include "temp.h" void filec() { mytemplate<int> asdf (5); int temp = asdf.getfoo(); } -------- temp.h -------- #ifndef Template_Included #define Template_Included template <class T> class mytemplate { T foo; public: mytemplate(T arg) { foo=arg; } T getfoo(); }; template <class T> T mytemplate<T>::getfoo() { return foo; } #endif
Local fix
Turn off -qtemplateregistry
Problem summary
USERS AFFECTED: Users who are using -qtemplateregistry and have some explicit instantiations in their code. Encountering the problem will depend on the order of compilation. PROBLEM DESCRIPTION: If the user compiles an implicit instantiation before an explicit instantiation, the registry will record the implicit and explicit instantiation and the compiler will create a recompile record. When the file with the implicit instantiation is recompiled, the compiler will try to eliminate the implicit one. However it is creating a recompile record instead of using the explicit instantiation. This will cause a source file to be recompiled that doesn't need to be. In some cases this can cause an unending loop of alternating between recompiles of files with implicit instantiations.
Problem conclusion
The -qtemplateregistry code needs to check for explicit instantiations before creating a recompile record for an implicit instantiation that is no longer defined in the object file.
Temporary fix
Comments
APAR Information
APAR number
IZ52119
Reported component name
XLC C++ AIX
Reported component ID
5724S7100
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2009-05-26
Closed date
2009-09-18
Last modified date
2009-09-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
XLC C++ AIX
Fixed component ID
5724S7100
Applicable component levels
[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0"}]
Document Information
Modified date:
03 October 2021