[Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
--- Comment #1 from oliver dot kellogg at eads dot com 2009-01-13 20:39 --- Created an attachment (id=17092) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17092&action=view) source code and makefiles for the test application Usage: $ tar xvzf gnat-shared_lib.tgz $ cd shared_lib $ make # will produce ./installed_lib/libadasharedlib.so et al. $ export LD_LIBRARY_PATH=$PWD/installed_lib $ cd testuser && make # will produce test program, appl_main $ ./appl_main -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38832
[Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
--- Comment #2 from oliver dot kellogg at eads dot com 2009-02-27 09:28 --- FWIW, pressing Ctrl-C in gdb when the program blocks shows following trace: Program received signal SIGINT, Interrupt. 0x0805bbd1 in system.soft_links.task_lock_nt () at s-soflin.adb:295 295procedure Task_Lock_NT is (gdb) bt #0 0x0805bbd1 in system.soft_links.task_lock_nt () at s-soflin.adb:295 #1 0x08053104 in system.file_io.close (file_ptr=0xbfffea7c, =2) at s-fileio.adb:220 #2 0x080532db in system.file_io.finalize (v=(prev => 0x0, next => 0x8076b60)) at s-fileio.adb:379 #3 0x0805461f in system.finalization_implementation.finalize_list (l=0x8076b94) at s-finimp.adb:361 #4 0x080546d9 in system.finalization_implementation.finalize_global_list () at s-finimp.adb:327 #5 0x0804ad12 in main (argc=1, argv=(system.address) 0xbfffed54, envp=(system.address) 0xbfffed5c) at /home/kellogg/ada/shared_lib/testuser/b~appl_main.adb:188 #6 0xb7ea2fe0 in __libc_start_main () from /lib/libc.so.6 #7 0x0804a951 in _start () -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38832
[Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
--- Comment #3 from oliver dot kellogg at eads dot com 2009-02-27 18:42 --- Expanding on comment #2, there seems to be an endless loop around s-fileio.adb:377ff. 376 Fptr1 := Open_Files; 377 while Fptr1 /= null loop 378 Fptr2 := Fptr1.Next; 379 Close (Fptr1'Access); 380 Fptr1 := Fptr2; 381 end loop; Setting a breakpoint at 376, Breakpoint 1, system.file_io.finalize (v=(prev => 0x0, next => 0x8078b60)) at s-fileio.adb:376 376 Fptr1 := Open_Files; (gdb) n 377 while Fptr1 /= null loop (gdb) p Fptr1 $28 = (access system.file_control_block.afcb) 0x8078a60 (gdb) p Fptr1.next $29 = (access system.file_control_block.afcb) 0x8078a00 (gdb) p Fptr1.next.next $30 = (access system.file_control_block.afcb) 0x80789a0 (gdb) p Fptr1.next.next.next $31 = (access system.file_control_block.afcb) 0x8078a60 (gdb) p Fptr1.next.next.next.next $32 = (access system.file_control_block.afcb) 0x8078a00 (gdb) p Fptr1.next.next.next.next.next $33 = (access system.file_control_block.afcb) 0x80789a0 .. and so on, indefinitely, where (gdb) p Fptr1.name.all $34 = "*stderr["00"]" (gdb) p Fptr1.next.name.all $35 = "*stdout["00"]" (gdb) p Fptr1.next.next.name.all $36 = "*stdin["00"]" -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38832
[Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
--- Comment #4 from oliver dot kellogg at eads dot com 2009-03-04 17:45 --- Created an attachment (id=17394) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17394&action=view) rough fix (patch to s-finimp.adb) Further investigation shows that Ada.Text_Io.Elab_{Spec,Body} is called by both adasharedlibinit (shared library) and adainit (main program.) The patch makes sure that multiple calls to System.Finalization_Implementation.Attach_To_Final_List with the same Obj parameter insert the Obj only once in the Global_Final_List. It may very well not be the Right Way (TM) to fix the problem, though. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38832
[Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
--- Comment #5 from silkensedai at online dot fr 2010-04-30 09:06 --- I got the same eror from a recent version of gnatpro: GNAT Pro 6.4.0w (20100131-43) Could someone look into this bug? thanks. -- silkensedai at online dot fr changed: What|Removed |Added CC||silkensedai at online dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38832
[Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
--- Comment #6 from charlet at gcc dot gnu dot org 2010-04-30 09:36 --- The bug is in your manual build procedure (the patch to s-finimp.adb is a kludge that would only hide the wrong build procedure) which is bypassing the gnat toolset normal operations. I would suggest using stand alone library project files which are designed for exactly this purpose, and will create a proper executable without calling elaboration twice, see the GNAT documentation for more details. -- charlet at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38832