From 03bf6579771e3ec70b2ead74b9bc159d655b6c26 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 28 Jul 2020 22:30:54 +0200 Subject: trans-chap8: avoid to create slice type too late. --- src/vhdl/translate/trans-chap8.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb index 5d662f410..1e7bb1956 100644 --- a/src/vhdl/translate/trans-chap8.adb +++ b/src/vhdl/translate/trans-chap8.adb @@ -2594,6 +2594,16 @@ package body Trans.Chap8 is Act_Type := Get_Type (Actual); end case; + -- If the actual is a slice, create the type early so that they + -- could be used in different states. If they are created too + -- late, they could be created in a state but referenced in + -- a different one. + if Actual /= Null_Iir + and then Get_Kind (Actual) = Iir_Kind_Slice_Name + then + Chap3.Create_Composite_Subtype (Act_Type, False); + end if; + -- For out or inout scalar variable, create a field for the -- actual value. if Actual /= Null_Iir -- cgit v1.2.3