This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/38607] AIX error messages about TOC during build
- From: "lukasz.filipkowski at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 23 Sep 2011 10:10:58 +0000
- Subject: [Bug bootstrap/38607] AIX error messages about TOC during build
- Auto-submitted: auto-generated
- References: <bug-38607-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38607
Lukasz Filipkowski <lukasz.filipkowski at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lukasz.filipkowski at gmail
| |dot com
--- Comment #15 from Lukasz Filipkowski <lukasz.filipkowski at gmail dot com> 2011-09-23 10:10:58 UTC ---
Hello,
regarding ld: 0711-768 WARNING when compiling:
> #include <string>
> #include <map>
> void foo()
> {
> std::map<std::string, std::string> bar;
> }
into rtl-enabled shared library. Warning is caused by code construction similar
to the one presented in the following example:
//g++ -save-temps -shared -Wl,-G -o libshare.so share.cc
#include <iostream>
#include <string>
using namespace std;
template<typename Key> class MyClass
{
public:
typedef Key KeyType;
MyClass(KeyType aNumber)
{
cout << aNumber << "! = " << factorial(aNumber) << endl;
}
~MyClass(){}
private:
long factorial(KeyType __x);
long factorialHelper(KeyType __x);
};
template<typename Key> long MyClass<Key>::factorial(KeyType __x)
{
if (__x <= 0) return 1;
else return __x * factorial(__x-1);
//else return __x * factorialHelper(__x-1);
}
template<typename Key> long MyClass<Key>::factorialHelper(KeyType __x)
{
return factorial(__x);
}
void foo()
{
MyClass<int> myClass(5);
}
$ g++ -save-temps -shared -Wl,-G -o libshare.so share.cc
ld: 0711-768 WARNING: Object share.o, section 1, function
.MyClass<int>::factorial(int):
The branch at address 0x36c is not followed by a recognized no-op
or TOC-reload instruction. The unrecognized instruction is 0x7C691B78.
Example code is based on contents of stl_tree.h file in which class _Rb_tree is
defined.
Warning is generated in case creation of shared libraries using TEMPLATE
CLASSES with RECURSIVE METHODS.
In the presented example "factorial" method is a recursive one.
When modifying:
template<typename Key> long MyClass<Key>::factorial(KeyType __x)
{
if (__x <= 0) return 1;
else return __x * factorial(__x-1);
//else return __x * factorialHelper(__x-1);
}
into:
template<typename Key> long MyClass<Key>::factorial(KeyType __x)
{
if (__x <= 0) return 1;
//else return __x * factorial(__x-1);
else return __x * factorialHelper(__x-1);
}
there is no linker warning.
The _Rb_tree class, defined in stl_tree.h, contains _M_erase and _M_copy
methods, both recursive.
Warning is present when using both GCC4.4.5 and GCC4.6.1 on AIX 5300-11-03-1013
(AIX5.3 TL11 SP03)
When using assembler program (as) from AIX 5300-08-02-0822 (AIX5.3 TL08 SP02)
there is no warning generated.
I'm not sure but problematic warning might be a result of fixes similar to
https://www-304.ibm.com/support/docview.wss?uid=isg1IZ24688