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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  2007-11-21 20:15 [Bug c++/34178] New: Compilation using -frepo fails rbuergel at web dot de
@ 2007-11-25  3:02 ` pinskia at gcc dot gnu dot org
  2007-11-27 17:24 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-25  3:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-11-25 03:02 -------
Confirmed, most likely what is happening is that we are not going back and
instatitating  A<T>::x during the link (which is the correct way of doing it).


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |link-failure
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-25 03:02:11
               date|                            |
            Summary|Compilation using -frepo    |[4.1/4.2/4.3 Regression]
                   |fails                       |Compilation using -frepo
                   |                            |fails
   Target Milestone|---                         |4.1.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178


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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-27 17:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-11-27 17:24 -------
The problem is that repo_emit_p decides something needs to be emitted as if
-fno-repo was used, but import_export_decl then can just ignore it and not emit
it anyway (set import_p = true).  When repo_emit_p said it should be emitted,
it doesn't add it to pending_repo, and then import_export_decl because -frepo
implies -fno-implicit-templates.
So, IMHO either we replace the occurences of flag_implicit_templates in
import_export_decl with flag_implicit_templates && !flag_use_repository,
i.e. when -frepo, we just honor what repo_emit_p told us, don't try to override
it, or at the end of function if (flag_use_repository && import_p && emit_p ==
2)
call some new function in repo.c which will add it to pending_repo.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178


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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-27 18:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2007-11-27 18:44 -------
Additionally, repo_emit_p should IMHO use DECL_INTEGRAL_CONSTANT_VAR_P
rather than DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P check - if a static
data member isn't const, then it really doesn't matter if it is initialized
by constant expression or not.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178


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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  2007-11-21 20:15 [Bug c++/34178] New: Compilation using -frepo fails rbuergel at web dot de
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-11-27 22:06 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178


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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  2007-11-21 20:15 [Bug c++/34178] New: Compilation using -frepo fails rbuergel at web dot de
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-28  6:41 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |11/msg01493.html
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-11-25 03:02:11         |2007-11-28 06:41:34
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178


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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  2007-11-21 20:15 [Bug c++/34178] New: Compilation using -frepo fails rbuergel at web dot de
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-09 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2007-12-09 21:26 -------
Subject: Bug 34178

Author: jakub
Date: Sun Dec  9 21:26:29 2007
New Revision: 130727

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130727
Log:
        PR c++/34178
        PR c++/34340
        * repo.c (repo_emit_p): Return 2 for DECL_INTEGRAL_CONSTANT_VAR_P
        in class scope rather than DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
        Return 2 also if DECL_EXPLICIT_INSTANTIATION.
        * decl2.c (import_export_decl): Don't make VAR_DECLs import_p when
        flag_use_repository and repo_emit_p returned 2.

        * g++.dg/template/repo6.C: New test.
        * g++.dg/template/repo7.C: New test.
        * g++.dg/template/repo8.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/template/repo6.C
    trunk/gcc/testsuite/g++.dg/template/repo7.C
    trunk/gcc/testsuite/g++.dg/template/repo8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/repo.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34178


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

* [Bug c++/34178] [4.1/4.2/4.3 Regression] Compilation using -frepo fails
  2007-11-21 20:15 [Bug c++/34178] New: Compilation using -frepo fails rbuergel at web dot de
                   ` (5 preceding siblings ...)
  2007-12-09 21:27 ` jakub at gcc dot gnu dot org
@ 2007-12-09 21:32 ` jakub at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-09 21:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2007-12-09 21:31 -------
Fixed.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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).