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] Spurious dimensionality errors on multitidimensional aggregates.


This patch removes spurious dimensionality errors on aggregates for multi-
dimensional arrays of scalar types with dimension specifications.

Compiling dimbug.ads below must yield:

   dimbug.ads:8:33: dimensions mismatch in array aggregate
   dimbug.ads:8:33: expected dimension [L], found [M]

---
with system.Dim.Mks; use System.Dim.Mks;
package dimbug is

 test_array_2 : array (1 .. 3, 1 .. 3) of Length :=
      (others => (others => 3.0 * m));    --  OK

 Bad_Array : array (1 .. 3, 1 .. 3) of Length :=
      (others => (others => 3.0 * kg));   --  ERROR
end;

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

2016-04-27  Ed Schonberg  <schonberg@adacore.com>

	* sem_dim.ads, sem_dim.adb (Check_Expression_Dimensions): New
	procedure to compute the dimension vector of a scalar expression
	and compare it with the dimensions if its expected subtype. Used
	for the ultimate components of a multidimensional aggregate,
	whose components typically are themselves aggregates that are
	expanded separately. Previous to this patch, dimensionality
	checking on such aggregates generated spurious errors.
	* sem_aggr.adb (Resolve_Array_Aggregate): Use
	Check_Expression_Dimensions when needed.

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]