public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34178]  New: Compilation using -frepo fails
@ 2007-11-21 20:15 rbuergel at web dot de
  2007-11-25  3:02 ` [Bug c++/34178] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: rbuergel at web dot de @ 2007-11-21 20:15 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-12-09 21:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-21 20:15 [Bug c++/34178] New: Compilation using -frepo fails rbuergel at web dot de
2007-11-25  3:02 ` [Bug c++/34178] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2007-11-27 17:24 ` jakub at gcc dot gnu dot org
2007-11-27 18:44 ` jakub at gcc dot gnu dot org
2007-11-27 22:06 ` mmitchel at gcc dot gnu dot org
2007-11-28  6:41 ` jakub at gcc dot gnu dot org
2007-12-09 21:27 ` jakub at gcc dot gnu dot org
2007-12-09 21:32 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).