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] Error recovery on array aggregates with illegal choice values


This patch improves error recovery on aggregates with named associations,
when the choices have type errors. Previous to this patch, the compiler
would loop or terminate with "compilation abandoned" on the following program.
Its compilation must yield:

conversion_boolean.adb:3:07: expected type "Standard.Boolean"
conversion_boolean.adb:3:07: found type universal integer
conversion_boolean.adb:4:07: expected type "Standard.Boolean"
conversion_boolean.adb:4:07: found type universal integer
---
procedure Conversion_Boolean is
   Boolean_To_Integer : constant array (Boolean) of Integer :=
     (0 => 15,      --   should have been (false => 15,
      1 => 16);     --   should have been true => 16);
   Bool_Int : Integer;
begin
   Bool_Int := Boolean_To_Integer (True);
   Bool_Int := Boolean_To_Integer (False);
end Conversion_Boolean;

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

2010-01-25  Ed Schonberg  <schonberg@adacore.com>

	* sem_aggr.adb (Resolve_Array_Aggregate): If the bounds in a choice
	have errors, do not continue resolution of the aggregate.
	* sem_eval.adb (Eval_Indexed_Component): Do not attempt to evaluate if
	the array type indicates an error.

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]