[Ada] Spurious alias error on access to array indexed by non-standard enum

Message ID 20171215141136.GA97921@adacore.com
State New
Headers show
Series
  • [Ada] Spurious alias error on access to array indexed by non-standard enum
Related show

Commit Message

Pierre-Marie de Rodat Dec. 15, 2017, 2:11 p.m.
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  <squirek@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  <squirek@adacore.com>

	* gnat.dg/aliasing4.adb: New testcase.

Patch

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)