diff options
-rw-r--r-- | src/vhdl/translate/trans-chap8.adb | 11 | ||||
-rw-r--r-- | testsuite/gna/issue2104/e.vhdl | 14 | ||||
-rw-r--r-- | testsuite/gna/issue2104/e2.vhdl | 18 | ||||
-rw-r--r-- | testsuite/gna/issue2104/e2b.vhdl | 19 | ||||
-rw-r--r-- | testsuite/gna/issue2104/e2c.vhdl | 15 | ||||
-rw-r--r-- | testsuite/gna/issue2104/e2d.vhdl | 19 | ||||
-rw-r--r-- | testsuite/gna/issue2104/e3.vhdl | 18 | ||||
-rwxr-xr-x | testsuite/gna/issue2104/testsuite.sh | 12 |
8 files changed, 124 insertions, 2 deletions
diff --git a/src/vhdl/translate/trans-chap8.adb b/src/vhdl/translate/trans-chap8.adb index 2b24e3737..05cac2c56 100644 --- a/src/vhdl/translate/trans-chap8.adb +++ b/src/vhdl/translate/trans-chap8.adb @@ -3307,7 +3307,9 @@ package body Trans.Chap8 is -- Set the PARAMS field. Assign_Params_Field (M2E (Mval), Mode_Value); end if; - elsif Formal_Info.Interface_Field (Mode_Value) /= O_Fnode_Null then + elsif Formal_Info.Interface_Decl (Mode_Value) = O_Dnode_Null + and then Formal_Info.Interface_Field (Mode_Value) /= O_Fnode_Null + then Assign_Params_Field (Val, Mode_Value); if Sig /= O_Enode_Null then @@ -3531,8 +3533,13 @@ package body Trans.Chap8 is Get_Association_Interface (El, Inter); Formal_Info : constant Ortho_Info_Acc := Get_Info (Base_Formal); begin - if Formal_Info.Interface_Field (Mode_Value) = O_Fnode_Null then + if Formal_Info.Interface_Decl (Mode_Value) /= O_Dnode_Null then -- Not a PARAMS field. + -- Note: an interface can be both a PARAMS field and an ortho + -- interface. This is the case for functions with nested + -- subprograms. At the start of those functions, the interface + -- is copied. But for a call, the actual must be passed as + -- a value of the interface. if Get_Kind (El) = Iir_Kind_Association_Element_By_Individual then -- Pass the whole data for an individual association. diff --git a/testsuite/gna/issue2104/e.vhdl b/testsuite/gna/issue2104/e.vhdl new file mode 100644 index 000000000..4c83a0824 --- /dev/null +++ b/testsuite/gna/issue2104/e.vhdl @@ -0,0 +1,14 @@ +entity e is +end; + +architecture a of e is + function outer(arg : integer) return integer is + function inner(arg : integer) return integer is + begin + return outer(0); + end; + begin + return inner(0); + end; +begin +end; diff --git a/testsuite/gna/issue2104/e2.vhdl b/testsuite/gna/issue2104/e2.vhdl new file mode 100644 index 000000000..e4690f2b7 --- /dev/null +++ b/testsuite/gna/issue2104/e2.vhdl @@ -0,0 +1,18 @@ +entity e2 is +end; + +architecture a of e2 is + function outer(arg : integer) return integer is + function inner1(arg : integer) return integer is + begin + return arg + 1; + end; + function inner2(arg : integer) return integer is + begin + return inner1(arg + 2); + end; + begin + return inner2(arg + 3); + end; +begin +end; diff --git a/testsuite/gna/issue2104/e2b.vhdl b/testsuite/gna/issue2104/e2b.vhdl new file mode 100644 index 000000000..de1422675 --- /dev/null +++ b/testsuite/gna/issue2104/e2b.vhdl @@ -0,0 +1,19 @@ +entity e2b is + generic (gen1 : natural := 5); +end; + +architecture a of e2b is + function outer(arg : integer) return integer is + function inner1(arg : integer) return integer is + begin + return arg + gen1; + end; + function inner2(arg : integer) return integer is + begin + return inner1(arg + 2); + end; + begin + return inner2(arg + 3); + end; +begin +end; diff --git a/testsuite/gna/issue2104/e2c.vhdl b/testsuite/gna/issue2104/e2c.vhdl new file mode 100644 index 000000000..e3ecae001 --- /dev/null +++ b/testsuite/gna/issue2104/e2c.vhdl @@ -0,0 +1,15 @@ +entity e2c is + generic (gen1 : natural := 5); +end; + +architecture a of e2c is + function outer(arg : integer) return integer is + function inner1(arg : integer) return integer is + begin + return arg + gen1; + end; + begin + return inner1(arg + 3); + end; +begin +end; diff --git a/testsuite/gna/issue2104/e2d.vhdl b/testsuite/gna/issue2104/e2d.vhdl new file mode 100644 index 000000000..0b541fc47 --- /dev/null +++ b/testsuite/gna/issue2104/e2d.vhdl @@ -0,0 +1,19 @@ +entity e2d is + generic (gen1 : natural := 5); +end; + +architecture a of e2d is + function outer(arg : integer) return integer is + function inner1(arg : integer) return integer is + begin + return arg + 1; + end; + function inner2(arg : integer) return integer is + begin + return inner1(arg + 2); + end; + begin + return gen1 + inner2(arg + 3); + end; +begin +end; diff --git a/testsuite/gna/issue2104/e3.vhdl b/testsuite/gna/issue2104/e3.vhdl new file mode 100644 index 000000000..f3641b52e --- /dev/null +++ b/testsuite/gna/issue2104/e3.vhdl @@ -0,0 +1,18 @@ +entity e3 is +end; + +architecture a of e3 is + function outer(arg : integer) return integer is + function inner1(arg : integer) return integer is + function inner2(arg : integer) return integer is + begin + return arg + 1; + end; + begin + return inner2(0); + end; + begin + return inner1(0); + end; +begin +end; diff --git a/testsuite/gna/issue2104/testsuite.sh b/testsuite/gna/issue2104/testsuite.sh new file mode 100755 index 000000000..02342e717 --- /dev/null +++ b/testsuite/gna/issue2104/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +for f in e e2 e2b e2c e2d e3; do + analyze $f.vhdl + elab_simulate $f +done + +clean + +echo "Test successful" |