This patch prevents the propagation of spurious errors about the prefix of
access being non-aliased when getting the access to an array indexed by an
enumeration with a custom representation.

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

gcc/ada/

2017-12-15  Justin Squirek  <squi...@adacore.com>

        * sem_attr.adb (Resolve_Attribute): Modify check for aliased view on
        prefix to use the prefix's original node to avoid looking at expanded
        conversions for certain array types.

gcc/testsuite/

2017-12-15  Justin Squirek  <squi...@adacore.com>

        * gnat.dg/aliasing4.adb: New testcase.
Index: sem_attr.adb
===================================================================
--- sem_attr.adb        (revision 255678)
+++ sem_attr.adb        (working copy)
@@ -11111,7 +11111,7 @@
               and then not (Nkind (P) = N_Selected_Component
                              and then
                                Is_Overloadable (Entity (Selector_Name (P))))
-              and then not Is_Aliased_View (P)
+              and then not Is_Aliased_View (Original_Node (P))
               and then not In_Instance
               and then not In_Inlined_Body
               and then Comes_From_Source (N)

Reply via email to