[Ada] Crash on discriminant check with current instance
Pierre-Marie de Rodat
derodat@adacore.com
Thu Dec 17 10:50:08 GMT 2020
This patch fixes an issue in the compiler whereby a reference to the
current instance of the type occurring within a subtype contraint causes
a crash during backend expansion of associated discriminant checks.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* checks.adb (Build_Discriminant_Checks): Add condition to
replace references to the current instance of the type when we
are within an Init_Proc.
(Replace_Current_Instance): Examine a given node and replace the
current instance of the type with the corresponding _init
formal.
(Search_And_Replace_Current_Instance): Traverse proc which calls
Replace_Current_Instance in order to replace all references
within a given expression.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1989 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201217/d525eb42/attachment-0001.bin>
More information about the Gcc-patches
mailing list