This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ada/6910: reproducible segmentation fault


>Number:         6910
>Category:       ada
>Synopsis:       When I run this code it segfaults.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 02 17:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     bam@snoopy.apana.org.au
>Release:        3.1 (Debian) (Debian unstable)
>Organization:
The Debian Project
>Environment:
System: Debian GNU/Linux (unstable)
Architecture: i686

	
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  gcc-3.1        3.1-2          The GNU C compiler.
ii  g++-3.1        3.1-2          The GNU C++ compiler.
ii  libstdc++4     3.1-2          The GNU stdc++ library version 3
ii  libstdc++4-dev 3.1-2          The GNU stdc++ library version 3 (developmen
ii  binutils       2.12.90.0.7-1  The GNU assembler, linker and binary utiliti
ii  libc6          2.2.5-6        GNU C Library: Shared libraries and Timezone
host: i386-linux
configured with: /mnt/data/gcc-3.1/gcc-3.1-3.1ds2/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=$\(prefix\)/share/man --infodir=$\(prefix\)/share/info --with-gxx-include-dir=$\(prefix\)/include/g++-v3-3.1 --enable-shared --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --enable-clocale=gnu --enable-threads=posix --enable-java-gc=boehm --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #147145.
  Please CC 147145@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/147145 ]

	When I run this code which combines the usage of
	GNAT.Dynamic_Tables and XmlAda in the one program, the program
	segfaults for some
	unknown reason. This occurs with the prior gcc-3.0 version of
	Gnat, too. (I apologize in advance if this problem is my
	fault, but I can't see any indication that is the case).

--- CUT ---
[532] [scrooge:bam] ~/tmp/ada/testbug >~/tmp/gnat-gdb-5/gdb/gdb ./testbug3
GNU gdb 5.0.gnat.3.15w-41
Copyright 2000 Free Software Foundation, Inc.
Ada Core Technologies version of GDB for GNAT Professional
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
See your support agreement for details of warranty and support.
If you do not have a current support agreement, then there is absolutely
no warranty for this version of GDB. Type show warranty for details.
This GDB was configured as "i686-pc-linux"...
(gdb) r
Starting program: /home/bam/tmp/ada/testbug/./testbug3 

Program received signal SIGSEGV, Segmentation fault.
0x80afd9f in system__finalization_implementation__finalize_list ()
(gdb) bt
#0  0x80afd9f in system__finalization_implementation__finalize_list ()
#1  0x80584a3 in <testbug3___deep_finalize.4> (v=@0x80c9f08, b=false)
    at testbug3.adb:41
#2  0x8058efb in testbug3 () at testbug3.adb:77
#3  0x8049f2e in main (argc=1, argv=3221223924, envp=<incomplete type>)
    at b~testbug3.adb:277
#4  0x4003a14f in __libc_start_main () from /lib/libc.so.6
--- CUT ---

>How-To-Repeat:
	Run this code:

--- CUT ---
with Ada.Text_IO;
use Ada.Text_IO;

with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;

with Input_Sources.File;
use Input_Sources.File;

with Tree_Readers;
use Tree_Readers;

with Sax.Readers;
use Sax.Readers;

with DOM.Core;
use DOM.Core;

with DOM.Core.Nodes;
use DOM.Core.Nodes;

with DOM.Core.Documents;
use DOM.Core.Documents;

with DOM.Core.Elements;
use DOM.Core.Elements;

with GNAT.Dynamic_Tables;

procedure TestBug3 is

   Read : File_Input;
   My_Tree_Reader : Tree_Reader;

   My_Tree : Document;
   My_Root : DOM.Core.Element;
   My_Nodes : Node_List;

   type Arm is delta 0.1 range 1_000.0 .. 5_000.0;
   type Litres is range 0..200;
   type Fuel_Tank is
      record
         Description  : Unbounded_String;
         The_Arm      : Arm;
         Maximum      : Litres;
      end record;

   package Fuel_Tank_Tables is
        new GNAT.Dynamic_Tables(Table_Component_Type=>Fuel_Tank,
                                Table_Index_Type=>Positive,
                                Table_Low_Bound=>1,
                                Table_Initial=>5,
                                Table_Increment=>50);
   use Fuel_Tank_Tables;

   T : Fuel_Tank_Tables.Instance;

begin
      Set_Public_Id (Read, "aircrafts.xml");
      Set_System_Id (Read, "aircrafts.xml");
      Open ("aircrafts.xml", Read);

--      Set_Feature (My_Tree_Reader, Validation_Feature, True);

--      Parse (My_Tree_Reader, Read);
      Close (Read);

--      Normalize(Get_Tree(My_Tree_Reader));

--      My_Tree := Get_Tree(My_Tree_Reader);
--      My_Root := Get_Element(My_Tree);
--      My_Nodes := DOM.Core.Elements.Get_Elements_By_Tag_Name(My_Root);

      Init(T);
      Set_Last(T,1);

      T.Table(1) :=
        (
         Description => To_Unbounded_String("Fuel Tank"),
         The_Arm => 2413.0,
         Maximum => 181
        );

end TestBug3;
--- CUT ---

For reference, I  compiler it with:

#!/bin/sh -ex

XMLADA=$HOME/tmp/xmlada-0.7.1
#gnatmake -g testbug3 -I$XMLADA/unicode -I$XMLADA/input_sources/ -I$XMLADA/dom -I$XMLADA/sax
gnatmake -gstabs+ testbug3 -I$XMLADA/unicode -I$XMLADA/input_sources/ -I$XMLADA/dom -I$XMLADA/sax


>Fix:
	Comment out the call to Close, Get_Element, and
	Get_Elements_By_Tag_Name.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]