public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4650] New: Destructor for the global object defined in a static library is called more than once
@ 2007-06-15 14:08 alexeyk at edifecs dot com
2007-06-15 14:10 ` [Bug libc/4650] " alexeyk at edifecs dot com
2007-06-15 14:21 ` jakub at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: alexeyk at edifecs dot com @ 2007-06-15 14:08 UTC (permalink / raw)
To: glibc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3947 bytes --]
Let us have:
1. Static library (St1) with global object (g_O)
2. Shared library Sh1 which links St1.
3. Shared library Sh2 which links St1.
4. Executable which dynamically loads Sh1 and Sh2.
During the load of Sh1 global object g_O is created at memory address, for
example, 0x01 (i.e. `this' pointer refers to 0x01). During the load of Sh2
global object g_O initialized once more, and if Sh1 was not unloaded yet g_Os
`this' pointer refers to 0x01 . Thus when Sh1 is unloaded object g_O at address
0x01 is destroyed and when Sh2 unloaded g_O at 0x01 destroyed once more.
Steps to reproduce:
1. Unpack the attached tarball. It contains the test case for the situation
described above.
2. Run "gmake" to compile the test case.
3. Change dir to the newly created ./bin
4. Run "./double_destruction"
Actual results:
Loading libmaster.so
this(0x8EAC20) ctor(Global)
this(0x8EAC20) out(master self)
Loading libslave.so
this(0x8EAC20) ctor(Global)
this(0x8EAC20) out(slave self)
this(0x8EAC20) dtor
this(0x8EAC20) dtor should not be called more than once!!!
That is:
Shared library libmaster.so is loaded
Constructor of the global object is called
Some method of the global object is executed
Shared library libslave.so is loaded
Constructor of the same global object is called once more
Some method of the global object is executed
Destructor of the global object is called
Destructor of the same global object is called once more
Expected results:
Loading libmaster.so
this(0x8EAC20) ctor(Global)
this(0x8EAC20) out(master self)
Loading libslave.so
this(0x8EAC20) out(slave self)
this(0x8EAC20) dtor
Found on:
GNU C Library stable release version 2.3.4, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
Compiled on a Linux 2.4.20 system on 2005-02-22.
Available extensions:
GNU libio by Per Bothner
crypt add-on version 2.1 by Michael Glad and others
Native POSIX Threads Library by Ulrich Drepper et al
The C stubs add-on version 2.1.2.
BIND-8.2.3-T5B
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Glibc-2.0 compatibility add-on by Cristian Gafton
GNU Libidn by Simon Josefsson
Thread-local storage support included.
Glibc version used for reproduction:
GNU C Library development release version 2.6.90, by Roland McGrath et al.
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.6.
Compiled on a Linux 2.4.20 system on 2007-06-14.
Available extensions:
GNU Libidn by Simon Josefsson
Native POSIX Threads Library by Ulrich Drepper et al
BIND-8.2.3-T5B
software FPU emulation by Richard Henderson, Jakub Jelinek and others
GCC -v:
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with: ../gcc-3.4.6/configure
Thread model: posix
gcc version 3.4.6
ld -v:
GNU ld version 2.15.92.0.2 20040927
--
Summary: Destructor for the global object defined in a static
library is called more than once
Product: glibc
Version: 2.3.4
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: alexeyk at edifecs dot com
CC: glibc-bugs at sources dot redhat dot com
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=4650
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-15 14:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-15 14:08 [Bug libc/4650] New: Destructor for the global object defined in a static library is called more than once alexeyk at edifecs dot com
2007-06-15 14:10 ` [Bug libc/4650] " alexeyk at edifecs dot com
2007-06-15 14:21 ` jakub at redhat dot com
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).