From d8667fd831a8281cdbc362e129a95db78010ffbc Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 24 Nov 2015 06:59:24 +0100 Subject: Fix a crash on conflict in under interpretation. --- src/vhdl/sem_scopes.adb | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb index 4add633..a31279c 100644 --- a/src/vhdl/sem_scopes.adb +++ b/src/vhdl/sem_scopes.adb @@ -326,8 +326,14 @@ package body Sem_Scopes is Cell : Interpretation_Cell renames Interpretations.Table (Inter); Prev : constant Name_Interpretation_Type := Cell.Prev; begin + -- Get_Under_Interpretation can be used only to get a hidden + -- interpretation. pragma Assert (Cell.Prev_Hidden); - if Valid_Interpretation (Prev) then + + if Valid_Interpretation (Prev) + -- Not a conflict one (use clauses). + and then Get_Declaration (Prev) /= Null_Iir + then return Prev; else return No_Name_Interpretation; @@ -1395,10 +1401,14 @@ package body Sem_Scopes is end if; Put (": "); Decl := Get_Declaration (Inter); - Put (Iir_Kind'Image (Get_Kind (Decl))); - Put_Line (", loc: " & Image (Get_Location (Decl))); - if Get_Kind (Decl) in Iir_Kinds_Subprogram_Declaration then - Put_Line (" " & Disp_Subprg (Decl)); + if Decl = Null_Iir then + Put_Line ("null: conflict"); + else + Put (Iir_Kind'Image (Get_Kind (Decl))); + Put_Line (", loc: " & Image (Get_Location (Decl))); + if Get_Kind (Decl) in Iir_Kinds_Subprogram_Declaration then + Put_Line (" " & Disp_Subprg (Decl)); + end if; end if; end Dump_Interpretation; -- cgit