public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/38832]  New: Main program runs fine but hangs on exit when linked with Ada shared lib
@ 2009-01-13 20:34 oliver dot kellogg at eads dot com
  2009-01-13 20:39 ` [Bug ada/38832] " oliver dot kellogg at eads dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: oliver dot kellogg at eads dot com @ 2009-01-13 20:34 UTC (permalink / raw)
  To: gcc-bugs

Running the test program from the attached tarfile
produces the expected output:

shared_lib/testuser> export LD_LIBRARY_PATH=../installed_lib
shared_lib/testuser> ./appl_main
Here is appl_main, now calling Pkg.Proc ...
Pkg.Proc: X is 2
Here is appl_main, back from calling Pkg.Proc: end of program.

However, the program hangs after the last output, i.e. does not relinquish
control back to the command line.

I tried this with FSF GCC versions 4.2.1 and svn 4.4 trunk
as well as with GNATGPL-2007 and 2008. Same behavior with all.


-- 
           Summary: Main program runs fine but hangs on exit when linked
                    with Ada shared lib
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: oliver dot kellogg at eads dot com
  GCC host triplet: i686-pc-linux-gnu


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


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

* [Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
  2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
@ 2009-01-13 20:39 ` oliver dot kellogg at eads dot com
  2009-02-27  9:29 ` oliver dot kellogg at eads dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: oliver dot kellogg at eads dot com @ 2009-01-13 20:39 UTC (permalink / raw)
  To: gcc-bugs



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


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

* [Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
  2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
  2009-01-13 20:39 ` [Bug ada/38832] " oliver dot kellogg at eads dot com
@ 2009-02-27  9:29 ` oliver dot kellogg at eads dot com
  2009-02-27 18:43 ` oliver dot kellogg at eads dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: oliver dot kellogg at eads dot com @ 2009-02-27  9:29 UTC (permalink / raw)
  To: gcc-bugs



------- 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
295        procedure 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, <file_ptrF>=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


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

* [Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
  2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
  2009-01-13 20:39 ` [Bug ada/38832] " oliver dot kellogg at eads dot com
  2009-02-27  9:29 ` oliver dot kellogg at eads dot com
@ 2009-02-27 18:43 ` oliver dot kellogg at eads dot com
  2009-03-04 17:45 ` oliver dot kellogg at eads dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: oliver dot kellogg at eads dot com @ 2009-02-27 18:43 UTC (permalink / raw)
  To: gcc-bugs



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


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

* [Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
  2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
                   ` (2 preceding siblings ...)
  2009-02-27 18:43 ` oliver dot kellogg at eads dot com
@ 2009-03-04 17:45 ` oliver dot kellogg at eads dot com
  2010-04-30  9:25 ` silkensedai at online dot fr
  2010-04-30  9:37 ` charlet at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: oliver dot kellogg at eads dot com @ 2009-03-04 17:45 UTC (permalink / raw)
  To: gcc-bugs



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


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

* [Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
  2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
                   ` (3 preceding siblings ...)
  2009-03-04 17:45 ` oliver dot kellogg at eads dot com
@ 2010-04-30  9:25 ` silkensedai at online dot fr
  2010-04-30  9:37 ` charlet at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: silkensedai at online dot fr @ 2010-04-30  9:25 UTC (permalink / raw)
  To: gcc-bugs



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


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

* [Bug ada/38832] Main program runs fine but hangs on exit when linked with Ada shared lib
  2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
                   ` (4 preceding siblings ...)
  2010-04-30  9:25 ` silkensedai at online dot fr
@ 2010-04-30  9:37 ` charlet at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: charlet at gcc dot gnu dot org @ 2010-04-30  9:37 UTC (permalink / raw)
  To: gcc-bugs



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


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

end of thread, other threads:[~2010-04-30  9:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-13 20:34 [Bug ada/38832] New: Main program runs fine but hangs on exit when linked with Ada shared lib oliver dot kellogg at eads dot com
2009-01-13 20:39 ` [Bug ada/38832] " oliver dot kellogg at eads dot com
2009-02-27  9:29 ` oliver dot kellogg at eads dot com
2009-02-27 18:43 ` oliver dot kellogg at eads dot com
2009-03-04 17:45 ` oliver dot kellogg at eads dot com
2010-04-30  9:25 ` silkensedai at online dot fr
2010-04-30  9:37 ` charlet 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).