public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9321: ctor not call in lib if a .cpp file doesn't have function called by the executable
@ 2003-01-15 10:26 lecroart
  0 siblings, 0 replies; 2+ messages in thread
From: lecroart @ 2003-01-15 10:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9321
>Category:       c++
>Synopsis:       ctor not call in lib if a .cpp file doesn't have function called by the executable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 15 02:26:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     gcc
>Release:        gcc (GCC) 3.2.1
>Organization:
>Environment:
Linux linuxdev01 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 unknown unknown GNU/Linux
>Description:
I create a lib that contains some .cpp. One .cpp in the lib contains only a ctor that should register into an array.
If I launch the executable, the ctor is not called (not registered). If now, I call, in the main, a function of the .cpp, now the ctor is called.
The behavior semms to be: If there s a .cpp without any function call in a lib, then ctor are not called.
>How-To-Repeat:
tar zxvf staticclass.tgz
./go
./a.out
look that only 2 string are registered (bug)
emacs main.cpp
uncomment the test_function();
./go
./a.out
look that the 3 string are registered (ok)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-gzip-compressed; name="staticclass.tgz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="staticclass.tgz"

H4sIAOiuIj4AA+1Za2/bNhT1V/NXXDgpKsWPSLZkAU46IEuTLFuyAnEGBOiCQqYom50ehkQ1TYv8
913Slix7CbwOjtNtOkAg6ZK8pEme+0oqXMEpDdw03a89EwzDMhzbxqdhOrZZfuaoGU7fNOyu07N6
NcPs9XtGDeznWlAZWSrcBKBG40ww3Ian+q1r/5ciLZ1/6PKoQ6fTTc9hmIbRt6wnz9/qdxfn38V+
pt21+zUwNr2Qx/A/P3+ywyMaZB6Dw1R4PO5MfiALWSPg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4Pjy7YefyA6+8ojNv5aNA14PaR3KMiTKWFkMdYEKhiOxp9ko
4HRAVJVtH4mGREkyKuKkVGLTqBTDzLjMS3a/uiGTHJ4xuCBomee3SH9NDtrTQ4wZYwoaKg9YpJV1
NM05pbGNTu+1x1W1oDzmYGlS2aHZlLIH+TtmVJmvdtkAFo3SOi2ZpNJAZQTnpg8NCTbtoIXh/oua
jFX+qxh7wwHAOv6bzqL+3zVMlf9Zlf/fCv6m/y98nrwfiyq/Kq7ruYNfKaYvuXcvlhV8GdHnfvSl
f3kFiUf5v+EAYB3/kftz/puO1ZX1P9vuVv//2woK/399MrwuBQDq8+xxYn8fnqtChQoVKlSo8E/x
Jx8gg4kAKAAA


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

* Re: c++/9321: ctor not call in lib if a .cpp file doesn't have function called by the executable
@ 2003-01-15 15:01 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-01-15 15:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, lecroart, nobody

Synopsis: ctor not call in lib if a .cpp file doesn't have function called by the executable

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Wed Jan 15 07:01:29 2003
State-Changed-Why:
    Right, this is standard Unix linker behavior: object files
    that are not referenced from outside are discarded. The
    file in which you run your constructor is thus simply
    thrown away by the linker, which explains why the constructor
    is not run.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9321


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

end of thread, other threads:[~2003-01-15 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-15 10:26 c++/9321: ctor not call in lib if a .cpp file doesn't have function called by the executable lecroart
2003-01-15 15:01 bangerth

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