This is the mail archive of the gcc-patches@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] Access types that designate limited views of types with tasks.


This patch fixes the handling of access types whose designated types are
limited views of untagged types with tasks.

executing the following:

   gnatmake -q main.adb
   main

must yield:

   Task started
   Task started

---
with Package_Common; use Package_Common;
with Package_A; use Package_A;

procedure Main is
  pClassA : Class_A_Ptr := new Class_A;
  aClassA : access Class_A := new Class_A;
  pTypeA  : Type_A_Ptr := new Type_A;
  aTypeA  : access Type_A := new Type_A;
  pTaskA  : Task_A_Ptr := new Task_A;
  aTaskA  : access Task_A := new Task_A;
begin
  -- OK
  pClassA.Start;
  pClassA.Start;
  Start (pTypeA);
  Start (aTypeA);

  pTaskA.Start;

  aTaskA.Start;
end Main;
---
package Package_A is
  type Class_A is tagged null record;

  procedure Start (self : in out Class_A) is null;

  type Type_A is null record;

  procedure Start (obj : access Type_A) is null;

  task type Task_A is
    entry Start;
  end Task_A;
end Package_A;
---
limited with Package_A;
package Package_Common is

  type Class_A_Ptr is access all Package_A.Class_A;

  type Type_A_Ptr is access all Package_A.Type_A;

  type Task_A_Ptr is access all Package_A.Task_A;

end Package_Common;
---
with text_IO; use text_IO;
package body Package_A is

  task body Task_A is
  begin
    accept Start do
      Put_Line ("Task started");
    end;
  end Task_A;
end Package_A;

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-08-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Access_Type_Declaration): If designated type is
	a limited view, create a master entity (as is already done for
	class-wide types) in case the full view designates a type that
	contains tasks.
	* sem_ch8.adb (Find_Selected_Component): If prefix is a dereference
	and the designated type is a limited view, use the non-limited
	view if available.

Attachment: difs
Description: Text document


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