ada: Fix source location for crashes in expanded Loop_Entry attributes
commit7434fb666749964aef4ae9de85848ed52cb18f32
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 10 Feb 2023 15:28:41 +0000 (10 16:28 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 22 May 2023 08:46:12 +0000 (22 10:46 +0200)
treed69caef18fa21892d1fe0959c98c3c69311d3c35
parentcf0d1f43ae471104a6120a8d1f89851974f8e27b
ada: Fix source location for crashes in expanded Loop_Entry attributes

Historically, Loop_Entry attributes were expanded while expanding their
corresponding loops, so it was easier to use location of these loops for
expanded code. Now, these attributes are expanded where they appear, so
we can easily use the location of the attribute reference for expanded
code.

This matters when there is a crash in the expanded code, e.g. because of
a stack overflow in the declaration of an constant object that captures
the Loop_Entry prefix. Now backtrace will point to the source location
of the attribute, which is more helpful than the location of the loop.

gcc/ada/

* exp_attr.adb (Expand_Loop_Entry_Attribute): Use location of the
attribute reference, not of the loop statement.
gcc/ada/exp_attr.adb