When a generic unit contains references to global entities (i.e. entities declared outside of this generic unit), those references are saved: from the analyzed copy of a generic unit (which is then discarded) into a generic template (which is then instantiated, possibly many times). To save those references we maintain an association from nodes in the generic template to nodes in the analyzed copy. However, this association breaks when analysis of the generic copy calls Relocate_Node, which conceptually only moves the node, while in fact it creates a copy with a new Node_Id. In particular, this association was broken by calls to Relocate_Node that happen when transforming various aspects into corresponding pragmas or attribute definition clases. For the most common Pre and Post aspects this was fixed years ago by not using Relocate_Node and simply sharing the tree. This patch extends this fix to other aspects, in particular those that allow non-static expressions. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch13.adb (Relocate_Expression): New routine with code that previously was only applied to Pre and Post aspects. (Analyze_Aspect_Specifications): Apply the above routine to other aspects, in particular to aspects Address, Attach_Handler, Predicate and Interrupt_Priority.