public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
@ 2003-11-29  1:03 carlo at gcc dot gnu dot org
  2003-11-29  1:04 ` [Bug c++/13227] " carlo at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-11-29  1:03 UTC (permalink / raw)
  To: gcc-bugs

This is a regression from g++ 3.3.x and earlier 3.4 CVS versions.

A call to dlclose() for a previously loaded
shared library closes ALL shared libraries
and destructs all global object in the process.

Very serious bug imho.  In previous versions
(g++-3.1, g++-3.1.1 and g++-3.2) even the standard
streams were closed as a result of a call to
dlclose() - I didn't check yet if that is now the
case too.

HOW TO REPRODUCE

I wrote a little test case.
Please download the tar ball, untar
and run 'make' in the resulting 
directory.

This was tested on i686-pc-linux-gnu
with CVS binutils 2.14.90 20031118 installed.

Using g++ 3.3.2:

~/c++/g++.bugs/bug15>make
g++-3.3.2 -I. -shared -fpic libA.cc -Wl,-soname,libA.so.0 -o libA.so.0.0.0
ln -sf libA.so.0.0.0 libA.so.0
ln -sf libA.so.0 libA.so
g++-3.3.2 -I. -shared -fpic libB.cc -Wl,-soname,libB.so.0 -o libB.so.0.0.0
ln -sf libB.so.0.0.0 libB.so.0
ln -sf libB.so.0 libB.so
g++-3.3.2 -I. main.cc -L. -lA -Wl,-rpath,./ -ldl -o main
~/c++/g++.bugs/bug15>main
Constructor of A
Constructor of B
Destructor of B
Program exitted successfully.
Destructor of A


And using a recent CVS version:

~/c++/g++.bugs/bug15>make
g++-cvs-3.4 -I. -shared -fpic libA.cc -Wl,-soname,libA.so.0 -o libA.so.0.0.0
ln -sf libA.so.0.0.0 libA.so.0
ln -sf libA.so.0 libA.so
g++-cvs-3.4 -I. -shared -fpic libB.cc -Wl,-soname,libB.so.0 -o libB.so.0.0.0
ln -sf libB.so.0.0.0 libB.so.0
ln -sf libB.so.0 libB.so
g++-cvs-3.4 -I. main.cc -L. -lA -Wl,-rpath,./ -ldl -o main
~/c++/g++.bugs/bug15>main
Constructor of A
Constructor of B
Destructor of A
Destructor of B
'a' was destroyed before it should be.

-- 
           Summary: [3.4 Regression] dlclose() causes destruction of global
                    objects in ALL shared C++ libraries.
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carlo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/13227] [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
  2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
@ 2003-11-29  1:04 ` carlo at gcc dot gnu dot org
  2003-11-29  1:43 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-11-29  1:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at gcc dot gnu dot org  2003-11-29 01:04 -------
Created an attachment (id=5228)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5228&action=view)
Test case.  Untar and run 'make'.


-- 


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


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

* [Bug c++/13227] [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
  2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
  2003-11-29  1:04 ` [Bug c++/13227] " carlo at gcc dot gnu dot org
@ 2003-11-29  1:43 ` pinskia at gcc dot gnu dot org
  2003-11-29 22:30 ` carlo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-29  1:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-29 01:43 -------
It is not a bug as you forgot to configure with --enable-__cxa_atexit.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c++/13227] [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
  2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
  2003-11-29  1:04 ` [Bug c++/13227] " carlo at gcc dot gnu dot org
  2003-11-29  1:43 ` pinskia at gcc dot gnu dot org
@ 2003-11-29 22:30 ` carlo at gcc dot gnu dot org
  2003-11-29 22:39 ` carlo at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-11-29 22:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at gcc dot gnu dot org  2003-11-29 22:29 -------
As we find out online...

But - I then updated from CVS, reconfigured the compiler,
re-bootstrapped it from scratch (includes a rm -rf objdir),
re-installed it... and get the very same bug.

~/c++/g++.bugs/bug15>make
g++-3.3.2 -I. -save-temps -shared -fpic libA.cc -Wl,-soname,libA.so.0 -o
libA.so.0.0.0
ln -sf libA.so.0.0.0 libA.so.0
ln -sf libA.so.0 libA.so
g++-3.3.2 -I. -save-temps -shared -fpic libB.cc -Wl,-soname,libB.so.0 -o
libB.so.0.0.0
ln -sf libB.so.0.0.0 libB.so.0
ln -sf libB.so.0 libB.so
g++-3.3.2 -I. -save-temps main.cc -L. -lA -Wl,-rpath,./ -ldl -o main
~/c++/g++.bugs/bug15>g++-3.3.2 -v
Reading specs from /usr/local/gcc-3.3.2/lib/gcc-lib/i386-redhat-linux/3.3.2/specs
Configured with: /usr/src/gcc/gcc-3.3.2/configure --prefix=/usr/local/gcc-3.3.2
--enable-shared --with-gnu-as --with-gnu-ld --enable-languages=c++
--enable-debug --enable-threads=posix --disable-checking --with-system-zlib
--enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.2
~/c++/g++.bugs/bug15>./main
Constructor of A
Constructor of B
Destructor of B
Program exitted successfully.
Destructor of A


~/c++/g++.bugs/bug15>vi Makefile
~/c++/g++.bugs/bug15>make clean
rm -f main libA.so* libB.so*
~/c++/g++.bugs/bug15>make
g++-cvs-3.4 -I. -save-temps -shared -fpic libA.cc -Wl,-soname,libA.so.0 -o
libA.so.0.0.0
ln -sf libA.so.0.0.0 libA.so.0
ln -sf libA.so.0 libA.so
g++-cvs-3.4 -I. -save-temps -shared -fpic libB.cc -Wl,-soname,libB.so.0 -o
libB.so.0.0.0
ln -sf libB.so.0.0.0 libB.so.0
ln -sf libB.so.0 libB.so
g++-cvs-3.4 -I. -save-temps main.cc -L. -lA -Wl,-rpath,./ -ldl -o main
~/c++/g++.bugs/bug15>g++-cvs-3.4 -v
Reading specs from /usr/src/GNU/install/bin/../lib/gcc/i686-redhat-linux/3.4/specs
Configured with: /usr/src/gcc/gcc-cvs-3.4/configure
--prefix=/usr/local/gcc-cvs-3.4 --enable-shared --with-gnu-as --with-gnu-ld
--enable-languages=c++ --enable-debug --enable-threads=posix --disable-checking
--with-system-zlib --enable-__cxa_atexit --host=i686-redhat-linux
Thread model: posix
gcc version 3.4 20031129 (experimental)
~/c++/g++.bugs/bug15>./main
Constructor of A
Constructor of B
Destructor of B
Destructor of A
'a' was destroyed before it should be.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug c++/13227] [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
  2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-11-29 22:30 ` carlo at gcc dot gnu dot org
@ 2003-11-29 22:39 ` carlo at gcc dot gnu dot org
  2003-11-29 22:40 ` carlo at gcc dot gnu dot org
  2003-11-30  0:32 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-11-29 22:39 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at gcc dot gnu dot org  2003-11-29 22:39 -------
Created an attachment (id=5237)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5237&action=view)
Test case after being run with g++-3.3.2 -save-temps

Added because Andrew has no access to an i686-pc-linux-gnu box.


-- 


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


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

* [Bug c++/13227] [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
  2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-11-29 22:39 ` carlo at gcc dot gnu dot org
@ 2003-11-29 22:40 ` carlo at gcc dot gnu dot org
  2003-11-30  0:32 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: carlo at gcc dot gnu dot org @ 2003-11-29 22:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From carlo at gcc dot gnu dot org  2003-11-29 22:40 -------
Created an attachment (id=5238)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5238&action=view)
Test case after being run with g++-cvs-3.4 -save-temps

Added because Andrew has no access to an i686-pc-linux-gnu box.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
Attachment #5228 is|0                           |1
           obsolete|                            |


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


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

* [Bug c++/13227] [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries.
  2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-11-29 22:40 ` carlo at gcc dot gnu dot org
@ 2003-11-30  0:32 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-30  0:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-11-30 00:32 -------
The cause of this bug is that the Visibility attribute is ignored, see PR 13134 so this is just a dup of 
that bug.

*** This bug has been marked as a duplicate of 13134 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2003-11-30  0:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-29  1:03 [Bug c++/13227] New: [3.4 Regression] dlclose() causes destruction of global objects in ALL shared C++ libraries carlo at gcc dot gnu dot org
2003-11-29  1:04 ` [Bug c++/13227] " carlo at gcc dot gnu dot org
2003-11-29  1:43 ` pinskia at gcc dot gnu dot org
2003-11-29 22:30 ` carlo at gcc dot gnu dot org
2003-11-29 22:39 ` carlo at gcc dot gnu dot org
2003-11-29 22:40 ` carlo at gcc dot gnu dot org
2003-11-30  0:32 ` pinskia 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).