This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34178] New: Compilation using -frepo fails
- From: "rbuergel at web dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2007 20:15:11 -0000
- Subject: [Bug c++/34178] New: Compilation using -frepo fails
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When compiling the following piece of code with "-frepo", linking fails
template<typename T>
class A
{
private:
static int x;
public:
int getX() { return x; }
};
template<typename T> int A<T>::x=0;
int main()
{
A<int> a;
a.getX();
}
g++ -frepo -c -o test.o test.cpp
g++ -o test test.o
collect: recompiling test.cpp
collect: relinking
test.o: In function `A<int>::getX()':
test.cpp:(.text+0x4): undefined reference to `A<int>::x'
collect2: ld returned 1 exit status
I tested this with an unpatched gcc 4.3.0 20071012 and 4.1.2 with on Gentoo
Linux.
gcc 3.4.6 compiles correctly.
Probably the output of the .rpo-files is interesting:
gcc-3:
M test.cpp
D /home/rbuergel/frepo-test
A '-frepo' '-c' '-o' 'test.o' '-march=i686'
C _ZN1AIiE1xE
O _ZN1AIiE4getXEv
gcc-4:
M test.cpp
D /home/rbuergel/frepo-test
A '-frepo' '-c' '-o' 'test.o' '-shared-libgcc' '-mtune=generic' '-march=i686'
'-frandom-seed=0x63d4762b' '-shared-libgcc'
C _ZN1AIiE4getXEv
gcc-4 gets it right, if x is just declared and defined, but not initialized.
--
Summary: Compilation using -frepo fails
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rbuergel at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178