public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ajd at gentrack dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/33704] AIX runs c++ constructors in incorrect order
Date: Wed, 10 Oct 2007 04:04:00 -0000	[thread overview]
Message-ID: <20071010040402.21334.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33704-8038@http.gcc.gnu.org/bugzilla/>



------- Comment #17 from ajd at gentrack dot com  2007-10-10 04:04 -------
(In reply to comment #16)
> lib1.a depends on lib2.a
> main depends on lib1.a, but does not explicitly link with lib2.a

main initializes what it is explicitly linked against.
lib1 initializes lib2 before it initializes itself.

--
See attached test_init_order.cpp:

$ # -- create lib2
$ g++ -shared -o lib2.a -D LIBNAME=LIB2 test_init_order.cpp
$ # -- create lib1 depends on lib2
$ g++ -shared -L. -l2 -o lib1.a -D LIBNAME=LIB1 -DCALLEE=LIB2
test_init_order.cpp
$ # -- hide lib2 from main
$ mv lib2.a /tmp/lib2.hide
$ # -- link main against lib1
$ g++ -L. -l1 -o m -D LIBNAME=main -DCALLEE=LIB1 test_init_order.cpp
$ # -- unhide lib2
$ mv /tmp/lib2.hide lib2.a
$ ./m
LIB2_init
LIB1_init
main_init
main()
LIB1()
LIB2()
main_fini
LIB1_fini
LIB2_fini
$ # -- replace lib1 with a library that doesn't depend on lib2
$ # -- leave main alone
$ g++ -shared -o lib1.a -D LIBNAME=LIB1 test_init_order.cpp
$ /usr/local/bin/sudo slibclean
$ ./m
LIB1_init
main_init
main()
LIB1()
main_fini
LIB1_fini


-- 


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


  parent reply	other threads:[~2007-10-10  4:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-09  1:46 [Bug target/33704] New: " ajd at gentrack dot com
2007-10-09  1:48 ` [Bug target/33704] " pinskia at gcc dot gnu dot org
2007-10-09  1:49 ` ajd at gentrack dot com
2007-10-09  1:50 ` ajd at gentrack dot com
2007-10-09  1:50 ` ajd at gentrack dot com
2007-10-09  1:56 ` ajd at gentrack dot com
2007-10-09  1:59 ` pinskia at gcc dot gnu dot org
2007-10-09  2:43 ` ajd at gentrack dot com
2007-10-09  3:43 ` bangerth at dealii dot org
2007-10-09 12:50 ` dje at gcc dot gnu dot org
2007-10-09 14:54 ` bangerth at dealii dot org
2007-10-09 15:08 ` dje at gcc dot gnu dot org
2007-10-09 15:18 ` bangerth at dealii dot org
2007-10-09 20:06 ` ajd at gentrack dot com
2007-10-09 21:10 ` dje at gcc dot gnu dot org
2007-10-09 21:45 ` ajd at gentrack dot com
2007-10-10  3:17 ` dje at gcc dot gnu dot org
2007-10-10  4:04 ` ajd at gentrack dot com [this message]
2007-10-12 12:56 ` dje at gcc dot gnu dot org
2007-10-14 21:39 ` ajd at gentrack dot com
2007-10-18  0:48 ` dje at gcc dot gnu dot org
2007-10-19  1:44 ` ajd at gentrack dot com
2007-10-19  2:01 ` bkoz at gcc dot gnu dot org
     [not found] <bug-33704-4@http.gcc.gnu.org/bugzilla/>
2013-11-23 15:38 ` dje at gcc dot gnu.org
2015-03-18 12:42 ` dje at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071010040402.21334.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).