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] | |
This patch corrects an oversight in the computation of size of multidimensional
packed arrays. Previously to this patch only the first dimension was used
to determine the number of storage units to compare.
Executing
gnatmake -q equality.adb
equality
must yield
Success - comparison claims these are different
---
with ADA.TEXT_IO;
procedure EQUALITY is
type FLAG_TYPE is (RED, GREEN);
for FLAG_TYPE'size use 1;
type TWO_DIM_ARRAY_TYPE is array
(INTEGER range 1 .. 16, INTEGER range 1 .. 16) of FLAG_TYPE;
pragma PACK(TWO_DIM_ARRAY_TYPE);
ARR_1 : TWO_DIM_ARRAY_TYPE := (others => (others => RED));
ARR_2 : TWO_DIM_ARRAY_TYPE := (others => (others => RED));
begin
ARR_2(2,1) := GREEN; -- Make the two arrays different.
if ARR_1 /= ARR_2
then
ADA.TEXT_IO.PUT_LINE("Success - comparison claims these are different");
else
ADA.TEXT_IO.PUT_LINE("Failure - comparison claims these are identical");
end if;
end EQUALITY;
Tested on x86_64-pc-linux-gnu, committed on trunk
2016-04-21 Ed Schonberg <schonberg@adacore.com>
* exp_pakd.adb (Compute_Number_Components): New function to
build an expression that computes the number of a components of
an array that may be multidimensional.
(Expan_Packed_Eq): Use it.
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] |