aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-01-19 06:00:47 +0100
committerTristan Gingold <tgingold@free.fr>2016-01-19 19:54:41 +0100
commit8f66fbcc06f13e871d60aa175e18183db9b4fb0a (patch)
tree12784f2248ecedb942f19fa63906329ed9d6cce1 /src
parent0474843607d5566bba92ba3b6e5674ddb33e4dc8 (diff)
downloadghdl-8f66fbcc06f13e871d60aa175e18183db9b4fb0a.tar.gz
ghdl-8f66fbcc06f13e871d60aa175e18183db9b4fb0a.tar.bz2
ghdl-8f66fbcc06f13e871d60aa175e18183db9b4fb0a.zip
Parse: detect ill-formed formal names. Fix bug24324.
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/parse.adb23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb
index 2991e07e3..d456131ae 100644
--- a/src/vhdl/parse.adb
+++ b/src/vhdl/parse.adb
@@ -6140,6 +6140,26 @@ package body Parse is
return Res;
end Parse_Process_Statement;
+ procedure Check_Formal_Form (Formal : Iir) is
+ begin
+ if Formal = Null_Iir then
+ return;
+ end if;
+
+ case Get_Kind (Formal) is
+ when Iir_Kind_Simple_Name
+ | Iir_Kind_Slice_Name
+ | Iir_Kind_Selected_Name =>
+ null;
+ when Iir_Kind_Parenthesis_Name =>
+ -- Could be an indexed name, so nothing to check within the
+ -- parenthesis.
+ null;
+ when others =>
+ Error_Msg_Parse ("incorrect formal name", Formal);
+ end case;
+ end Check_Formal_Form;
+
-- precond : NEXT_TOKEN
-- postcond: NEXT_TOKEN
--
@@ -6216,6 +6236,9 @@ package body Parse is
when Tok_Double_Arrow =>
Formal := Actual;
+ -- Check that FORMAL is a name and not an expression.
+ Check_Formal_Form (Formal);
+
-- Skip '=>'
Scan;
Loc := Get_Token_Location;