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] Crash processing comparison of composite objects


Comparisons of composite objects may be internally transformed by the
frontend into a special kind of node that facilitates their internal
management. If processing the comparison causes the internal declaration
of a subtype declaration associated with some sub-expression, the backend
may crash when generating the code.

After this patch the following test compiles fine.

package Q is
  type Rec (D : Positive) is record
    S : String (1 .. D);
  end record;

  type Field_T is (One);

  type Mask_T is array (Field_T) of Boolean;

  function F return Rec;
end Q;

with Q; use Q;
procedure P (A : Rec) is
  M : Mask_T;
  use type Rec;
begin
  M := (One => A /= F);
end;

Command: gcc -c p.adb

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

2017-04-25  Javier Miranda  <miranda@adacore.com>

	* sem_util.adb (New_Copy_Tree.Visit_Entity): Extend previous change
	to generate new entities for subtype declarations located in
	Expression_With_Action nodes.

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]