From: Javier Miranda Date: Mon, 16 Jul 2018 14:10:53 +0000 (+0000) Subject: [Ada] Bit_Order cannot be defined for record extensions X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2588c36c2ea1f62176b07268fa7a8e0cedeb4fbf;p=gcc.git [Ada] Bit_Order cannot be defined for record extensions This patch allows the compiler to report an error on Bit_Order when defined for a record extension. 2018-07-16 Javier Miranda gcc/ada/ * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Report an error on Bit_Order when defined for a record extension. gcc/testsuite/ * gnat.dg/bit_order1.adb: New testcase. From-SVN: r262712 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a09f67fda09..51b73f8bf23 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-07-16 Javier Miranda + + * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Report an error + on Bit_Order when defined for a record extension. + 2018-07-16 Arnaud Charlet * libgnat/s-objrea.ads: Minor code clean up. diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index ad9e9a140c9..17b138d38d0 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -5331,6 +5331,12 @@ package body Sem_Ch13 is Error_Msg_N ("Bit_Order can only be defined for record type", Nam); + elsif Is_Tagged_Type (U_Ent) + and then Is_Derived_Type (U_Ent) + then + Error_Msg_N + ("Bit_Order cannot be defined for record extensions", Nam); + elsif Duplicate_Clause then null; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f73096e0f30..df006b69119 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-07-16 Javier Miranda + + * gnat.dg/bit_order1.adb: New testcase. + 2018-07-16 Javier Miranda * gnat.dg/iter2.adb, gnat.dg/iter2.ads: New testcase. diff --git a/gcc/testsuite/gnat.dg/bit_order1.adb b/gcc/testsuite/gnat.dg/bit_order1.adb new file mode 100644 index 00000000000..5fe813b1f13 --- /dev/null +++ b/gcc/testsuite/gnat.dg/bit_order1.adb @@ -0,0 +1,18 @@ +-- { dg-do compile } + +with System; + +procedure Bit_Order1 is + + type Sample_Ttype is tagged record + Data : Natural; + end record; + + type Other_Type is new Sample_Ttype with record + Other_Data : String (1 .. 100); + end record; + + for Other_Type'Bit_Order use System.High_Order_First; -- { dg-error "Bit_Order cannot be defined for record extensions" } +begin + null; +end;