See the attached world_test_main program.

This was taken from a working program with as much code removed as possible.

$ gnatchop blob.adb
$ gnatmake world_test_main
$ ./world_test_main
test_tasks(1)_0000000800A50500: waiting to initialize
world_task_0000000800A0B700: running
main_task_0000000800A0AA00: initializing tasks
test_tasks(1)_0000000800A50500: initialized
test_tasks(1)_0000000800A50500: logged in
test_tasks(1)_0000000800A50500: fetching messages

raised STORAGE_ERROR : s-intman.adb:139 explicit raise

Running in gdb shows:

Program received signal SIGSEGV, Segmentation fault.
0x00007fffff9fd9e8 in ?? ()
(gdb) bt
#0  0x00007fffff9fd9e8 in ?? ()
#1  0x000000000040e3fa in world.player_sessions.update_element (container=...,
position=..., process=0x7fffff9fd9e8)
    at
/storage/volatile/gnat_build/builds/8.0/x86_64/svn-r155934/lib/gcc/x86_64-unknown-freebsd8.0/4.5.0/adainclude/a-cohama.adb:853
#2  0x000000000040f6f8 in world.world_state.player_fetch_messages
(<_object>=..., name=..., messages=...)
    at world.adb:67
#3  0x000000000040f767 in <world__world_state__player_fetch_messagesP>
(name=..., messages=...) at world.adb:49
#4  0x000000000040f9ad in world.fetch_messages (name=..., messages=...) at
world.adb:114
#5  0x000000000041176a in <world_test__test_taskTB> (<_task>=0x55bda0) at
world_test.adb:50
#6  0x0000000000419260 in system.tasking.stages.task_wrapper
(self_id=0x800a50500) at s-tassta.adb:1188
#7  0x00000008006974b1 in ?? () from /lib/libthr.so.3
#8  0x0000000000000000 in ?? ()
(gdb) up
#1  0x000000000040e3fa in world.player_sessions.update_element (container=...,
position=..., process=0x7fffff9fd9e8)
    at
/gnat/builds/8.0/x86_64/svn-r155934/lib/gcc/x86_64-unknown-freebsd8.0/4.5.0/adainclude/a-cohama.adb:853
853                 Process (K, E);
(gdb) print Process
$1 = (access procedure (a1: world.player_sessions.key_typeX; a2: <ref>
world.queue.vector)) 0x7fffff9fd9e8

This looks like it could possibly be a code generation error. The access to
Process seems to be invalid:

$ gdb world_test_main
(gdb) b world.adb:62
Breakpoint 1 at 0x40f6cf: file world.adb, line 62.
(gdb) r
Starting program:
/storage/home/m0/doc/dev/2010/01/another_gnat_bug2/test/world_test_main 
test_tasks(1)_0000000800A50500: waiting to initialize
world_task_0000000800A0B700: running
main_task_0000000800A0AA00: initializing tasks
test_tasks(1)_0000000800A50500: initialized
test_tasks(1)_0000000800A50500: logged in
test_tasks(1)_0000000800A50500: fetching messages

Breakpoint 1, world.world_state.player_fetch_messages (<_object>=..., name=...,
messages=...) at world.adb:67
67            Player_Sessions.Update_Element
(gdb) s
world.player_sessions.update_element (container=..., position=...,
process=0x7fffff9fd9e8)
    at
/storage/volatile/gnat_build/builds/8.0/x86_64/svn-r155934/lib/gcc/x86_64-unknown-freebsd8.0/4.5.0/adainclude/a-cohama.adb:827
827           if Position.Node = null then
(gdb) s
832           if Position.Container /= Container'Unrestricted_Access then
(gdb) s
world_task_0000000800A0B700845           B := B + 1;
(gdb) s
: running846             L := L + 1;
(gdb) s

849                 K : Key_Type renames Position.Node.Key;
(gdb) s
850                 E : Element_Type renames Position.Node.Element;
(gdb) s
853                 Process (K, E);
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x00007fffff9fd9e8 in ?? ()

I've tested with every build of GCC I have from 4.4.0 to SVN r155934 on both
x86 and x86_64 and the point of failure is identical each time.


-- 
           Summary: Crash in Ada.Containers.Vectors.Update_Element
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at coreland dot ath dot cx
  GCC host triplet: x86_64-unknown-freebsd8.0


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

Reply via email to