ada: Crash on applying 'Pos to expression of a type derived from a formal type
authorGary Dismukes <dismukes@adacore.com>
Wed, 2 Nov 2022 23:02:34 +0000 (19:02 -0400)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 14 Nov 2022 13:46:50 +0000 (14:46 +0100)
commit90b9052e0b5df49d6c298c4706978135d2af2a86
tree3b84aec76240802c476f3ae5e78994ac1ea61762
parent0a2304a04925e43a50a345fb6a0b0c8ba180a973
ada: Crash on applying 'Pos to expression of a type derived from a formal type

The compiler crashes when trying to do a static check for a range violation
in a type conversion of a Pos attribute applied to a prefix of a type derived
from a generic formal discrete type. This optimization was suppressed in the
case of formal types, because the upper bound may not be known, but it also
needs to be suppressed for types derived from formal types.

gcc/ada/

* checks.adb
(Apply_Type_Conversion_Checks): Apply Root_Type to the type of the
prefix of a Pos attribute when checking whether the type is a
formal discrete type.
gcc/ada/checks.adb