diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-12-08 06:49:16 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-12-08 06:56:44 +0100 |
commit | 151a1afff5c36a4681820a704cf60922d26df5b5 (patch) | |
tree | ab95be266f5990bce93d744b33a19abfc16a18e8 /src/vhdl/parse.adb | |
parent | 21c4e05f02573e15c3fcbc43950928b55806a3ae (diff) | |
download | ghdl-151a1afff5c36a4681820a704cf60922d26df5b5.tar.gz ghdl-151a1afff5c36a4681820a704cf60922d26df5b5.tar.bz2 ghdl-151a1afff5c36a4681820a704cf60922d26df5b5.zip |
Avoid crash on string as prefix of procedure call.
Fix #478
Diffstat (limited to 'src/vhdl/parse.adb')
-rw-r--r-- | src/vhdl/parse.adb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index f7085c081..93e8cfd07 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -6139,6 +6139,7 @@ package body Parse is is Res: Iir; Call : Iir_Procedure_Call; + Prefix : Iir; begin Res := Create_Iir (Kind); Location_Copy (Res, Name); @@ -6147,7 +6148,12 @@ package body Parse is Set_Procedure_Call (Res, Call); case Get_Kind (Name) is when Iir_Kind_Parenthesis_Name => - Set_Prefix (Call, Get_Prefix (Name)); + Prefix := Get_Prefix (Name); + if Get_Kind (Prefix) = Iir_Kind_Operator_Symbol then + Error_Msg_Parse + (+Prefix, "operator cannot be used as procedure call"); + end if; + Set_Prefix (Call, Prefix); Set_Parameter_Association_Chain (Call, Get_Association_Chain (Name)); Free_Iir (Name); @@ -6156,6 +6162,9 @@ package body Parse is Set_Prefix (Call, Name); when Iir_Kind_Attribute_Name => Error_Msg_Parse ("attribute cannot be used as procedure call"); + when Iir_Kind_String_Literal8 => + Error_Msg_Parse + ("string or operator cannot be used as procedure call"); when others => Error_Kind ("parenthesis_name_to_procedure_call", Name); end case; |