This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-frepo and function templates not working correctly?


Hello,


I already asked this question on Dec 9 but got no response. Now I found a
much smaller test showing the same problem:


    template <class T>
    void fun(T& t)
    {
      t = t;// just for fun, here we do nothing
    } 
   
    int main()
    {
      int a;
      fun(a);
    }


Compiling it with egcs-971215 (or egcs-1.0) gives: 

    $ gmake
    /opt/egcs/bin/g++ -g -frepo -c foo.C
    /opt/egcs/bin/g++ -g -o foo foo.o
    foo.o: In function `main':
    /home/stuebing/tmp/foo.C:15: undefined reference to `void fun<int>(int &)'
    collect2: ld returned 1 exit status
    gmake: *** [foo] Error 1
    $ cat foo.rpo
    M foo.C
    D /home/stuebing/tmp
    A '-g' '-frepo' '-c'
    O fun__H1Zi_RX01_v

Including the line 'template void fun<int>(int &);' once in foo.C and
compiling it with -frepo results in a binary, the foo.rpo however now
contains

    M foo.C
    D /home/stuebing/tmp
    A '-g' '-frepo' '-c'
    C fun__H1Zi_RX01_v

Now I can remove the line 'template void fun<int>(int &);' and compile
again with -frepo and now I always get a binary, up until I remove the
foo.rpo file.

Compiling without -frepo results always in a binary. gcc-2.7.2 works
nicely with such kind of code.

My system is a RedHat 4.1, binutils-2.8.1.0.1-1, libc-5.4.36-1. I even
tried the binutils-2.8.1.0.15.bin.tar.gz, but also no success.

What's wrong? Thanks a very lot on your work on egcs.


Andreas Stuebinger



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]