From d21e124878d263df867487cf027cb36215f00f10 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 16 Oct 2015 15:56:49 +0000 Subject: [PATCH] re PR middle-end/67966 (ICE in convert_move, at expr.c:282) PR middle-end/67966 * gnat.dg/pack21.adb: New test. * gnat.dg/pack22.adb: Likewise. * gnat.dg/pack22_pkg.ad[sb]: New helper. From-SVN: r228917 --- gcc/testsuite/ChangeLog | 15 +++++-- gcc/testsuite/gnat.dg/pack21.adb | 29 +++++++++++++ gcc/testsuite/gnat.dg/pack22.adb | 19 +++++++++ gcc/testsuite/gnat.dg/pack22_pkg.adb | 16 +++++++ gcc/testsuite/gnat.dg/pack22_pkg.ads | 62 ++++++++++++++++++++++++++++ 5 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gnat.dg/pack21.adb create mode 100644 gcc/testsuite/gnat.dg/pack22.adb create mode 100644 gcc/testsuite/gnat.dg/pack22_pkg.adb create mode 100644 gcc/testsuite/gnat.dg/pack22_pkg.ads diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8701cb44988..8f71c0b1456 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,10 +1,17 @@ +2015-10-16 Eric Botcazou + + PR middle-end/67966 + * gnat.dg/pack21.adb: New test. + * gnat.dg/pack22.adb: Likewise. + * gnat.dg/pack22_pkg.ad[sb]: New helper. + 2015-10-16 Christian Bruel PR target/67745 - * gcc.target/arm/no-align.c: New test. - * gcc.target/arm/attr-align1.c: New test. - * gcc.target/arm/attr-align2.c: New test. - * gcc.target/arm/attr-align3.c: New test. + * gcc.target/arm/no-align.c: New test. + * gcc.target/arm/attr-align1.c: New test. + * gcc.target/arm/attr-align2.c: New test. + * gcc.target/arm/attr-align3.c: New test. 2015-10-11 Jan Hubicka diff --git a/gcc/testsuite/gnat.dg/pack21.adb b/gcc/testsuite/gnat.dg/pack21.adb new file mode 100644 index 00000000000..3749f445400 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack21.adb @@ -0,0 +1,29 @@ +-- { dg-do compile } +-- { dg-options "-gnatws" } + +procedure Pack21 is + + type Enum is (ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, + SEVEN, EIGHT, NINE, TEN, ELEVEN, TWELVE, + THIRTEEN, FOURTEEN, FIFTEEN); + + type Rec1 is record + I1 : INTEGER range 0 .. 800; + I2 : INTEGER range 0 .. 15 := 0; + E : Enum; + end record; + pragma PACK (Rec1); + + type Rec2 is record + F : Rec1; + end record; + + for Rec2 use record + F at 0 range 2 .. 19; + end record; + + R1, R2 : Rec2; + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/pack22.adb b/gcc/testsuite/gnat.dg/pack22.adb new file mode 100644 index 00000000000..e84948abd2b --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack22.adb @@ -0,0 +1,19 @@ +-- { dg-do compile } +-- { dg-options "-O -gnatws" } + +with Pack22_Pkg; use Pack22_Pkg; + +procedure Pack22 is + + package Role_Map is new Bit_Map_Generic; + + type Role_List is new Role_Map.List; + Roles_1 : Role_List; + Roles_2 : Role_List; + Roles_3 : Role_List; + +begin + Temp_buffer := (others => 1); + Temp_Buffer(2) := (0); + Roles_1 := Roles_2 xor Roles_3; +end; diff --git a/gcc/testsuite/gnat.dg/pack22_pkg.adb b/gcc/testsuite/gnat.dg/pack22_pkg.adb new file mode 100644 index 00000000000..7531a1702a5 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack22_pkg.adb @@ -0,0 +1,16 @@ +package body Pack22_Pkg is + + package body Bit_Map_Generic is + + function "xor" (L, R : List) return List is + Temp : List; + for Temp'address use Temp_buffer'address; + begin + Temp.Bits := L.Bits xor R.Bits; + Temp.Counter.Counter := 0; + return Temp; + end; + + end Bit_Map_Generic; + +end Pack22_Pkg; diff --git a/gcc/testsuite/gnat.dg/pack22_pkg.ads b/gcc/testsuite/gnat.dg/pack22_pkg.ads new file mode 100644 index 00000000000..74053b38eb6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/pack22_pkg.ads @@ -0,0 +1,62 @@ +package Pack22_Pkg is + + type byte is mod 256; + Temp_buffer : array (0..8) of byte:= (others => 0); + for Temp_buffer'Alignment use 2; + + subtype Id is Short_integer; + + generic + Dummy : Integer := 0; + package Bit_Map_Generic is + + type List is private; + function "xor" (L, R : List) return List; + + private + type Offset_T is range 0 .. Id'Last; + type Counter_T is new short_integer; + for Counter_T'Size use 16; + + type Bit_List is array (Id range <>) of Boolean; + pragma Pack (Bit_List); + + type List_Counter_T (Is_Defined : Boolean := True) is + record + Dummy : Boolean := False; + case Is_Defined is + when True => + Counter : Counter_T := 0; + when False => + null; + end case; + end record; + for List_Counter_T use + record + Is_Defined at 0 range 0 .. 7; + Dummy at 1 range 0 .. 7; + Counter at 2 range 0 .. 15; + end record; + + type List is + record + Offset : Offset_T := Offset_T (1) - 1; + Counter : List_Counter_T; + Bits : Bit_List (1 .. 6); + end record; + for List use + record + Offset at 0 range 0 .. 15; + Counter at 2 range 0 .. 31; + end record; + + type Iterator is + record + No_More_Id : Boolean := True; + Current_Id : Id; + The_List : List; + end record; + + end Bit_Map_Generic; + +end Pack22_Pkg; -- 2.30.2