From: stvcook53@gmail.com
Subject: Gnat Version 4.5.4 v protected objects v tasking
Date: Tue, 23 Apr 2013 13:30:45 -0700 (PDT)
Date: 2013-04-23T13:30:45-07:00 [thread overview]
Message-ID: <9a00b621-0b00-4ef3-8600-ebcb9dd159c6@googlegroups.com> (raw)
Please consider sample code and comment to remedy failure in code sample or compiler.
Tried several versions of GPL Gnat Ada this year to build under x86_64 RHEL5 OS where previously succeeded with i386 OS. Fortunately, the 4.5.4 libre gnat builds all my source code, but exhibits strange run-time symptoms using a sample that worked with older Gnat versions.
Symptoms out of 4.5.4 relate to the tasking portion of the Ada run-time system, and relate to protected objects when located outside the main program. Symptoms manifest as a silent hang when a program is run that includes the tasking portion of the runtime system. The gdb debugger exhibits a SIGSEGV while in the run-time package System.Secondary_Stack. Symptom occurs at the end of elaboration before control enters main program. Please comment on sample code or planned, related Gnat updates.
Note: Internal compilation errors are common when trying to build my larger code using older Gnat versions in x86_64 configuration. This includes 3.1.6, 4.1.0, and 4.3.6. Emphasis on run-time in latest Gnat is derived from its success at building other code.
Sample code is summarized as follows:
main(Test_Protected_Object)
with Contrived;
spec(Contrived)
body(Contrived) note: 3 types
1. no tasking
2. protected object
3. task
Detailed code follows:
--main***
--Simple program to attempt to reproduce segmentation fault.
with Ada.Text_IO;
with Ada.Exceptions;
with Ada.Command_Line;
with Contrived; -- add code actually involved in segmentation fault
procedure Test_Protected_Object is
begin --Test_Protected_Object
Ada.Text_IO.Put_Line("Test_Protected_Object: ");
Ada.Text_IO.Put_Line(" The program name is "
& Ada.Command_Line.Command_Name);
Ada.Text_IO.Put_Line("** before referencing protected object: ");
Contrived.Print_This;
Ada.Text_IO.Put_Line("*** after referencing protected object: ");
exception
when E:others =>
Ada.Text_IO.Put_Line("** unexpected exception "
& Ada.Exceptions.Exception_Name(E));
end Test_Protected_Object;
--spec(Contrived) ***
-------------------------------------------------------------------------------
-- Contrived package containing:
-- a. no tasking
-- b. a protected object
-- c. a task
-- in the package body, depending upon which configuration I which to test.
-------------------------------------------------------------------------------
package Contrived is
procedure Print_This;
end Contrived;
--body(Contrived - Option A no symptom) ***
-------------------------------------------------------------------------------
-- Contrived package containing:
-- a. no tasking
-- b. a protected object
-- c. a task
-- in the package body, depending upon which configuration I which to test.
-------------------------------------------------------------------------------
-- this is configuration a.
with Ada.Text_IO;
package body Contrived is
procedure Print_This is
begin
Ada.Text_IO.Put_Line("Contrived: Print_This");
end Print_This;
end Contrived;
--body(Contrived - Option B symptom) ***
-------------------------------------------------------------------------------
-- Contrived package containing:
-- a. no tasking
-- b. a protected object
-- c. a task
-- in the package body, depending upon which configuration I which to test.
-------------------------------------------------------------------------------
-- this is configuration b.
with Ada.Text_IO;
package body Contrived is
protected Object is
procedure Print_That;
end Object;
protected body Object is
procedure Print_That is
begin
Ada.Text_IO.Put_Line("Contrived.Object.Print_That");
end Print_That;
end Object;
procedure Print_This is
begin
Ada.Text_IO.Put_Line("Contrived: Print_This");
Object.Print_That;
end Print_This;
end Contrived;
--body(Contrived - Option C same symptom) ***
-------------------------------------------------------------------------------
-- Contrived package containing:
-- a. no tasking
-- b. a protected object
-- c. a task
-- in the package body, depending upon which configuration I which to test.
-------------------------------------------------------------------------------
-- this is configuration c.
with Ada.Text_IO;
package body Contrived is
task Object is
entry Print_That;
end Object;
task body Object is
begin
loop
select
accept Print_That;
Ada.Text_IO.Put_Line("Contrived.Object.Print_That");
or
terminate;
end select;
end loop;
end Object;
procedure Print_This is
begin
Ada.Text_IO.Put_Line("Contrived: Print_This");
Object.Print_That;
end Print_This;
end Contrived;
next reply other threads:[~2013-04-23 20:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-23 20:30 stvcook53 [this message]
2013-04-23 22:03 ` Gnat Version 4.5.4 v protected objects v tasking Simon Wright
2013-04-24 13:21 ` stvcook53
2013-04-29 13:15 ` stvcook53
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox