diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 18b684b64..7bec4d6b3 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1860,7 +1860,7 @@ private: VSymEnt* m_pinSymp = nullptr; // SymEnt for pin lookups const AstCell* m_cellp = nullptr; // Current cell AstNodeModule* m_modp = nullptr; // Current module - const AstNodeFTask* m_ftaskp = nullptr; // Current function/task + AstNodeFTask* m_ftaskp = nullptr; // Current function/task int m_modportNum = 0; // Uniqueify modport numbers struct DotStates { @@ -2748,8 +2748,11 @@ private: if (foundp) { if (VN_IS(foundp->nodep(), Var) && m_ds.m_dotText == "" && m_ftaskp && m_ftaskp->name() == foundp->nodep()->name()) { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: Recursive function call " - << nodep->prettyNameQ()); + // This is a recursive reference to the function itself, not to the var + nodep->taskp(m_ftaskp); + nodep->classOrPackagep(foundp->classOrPackagep()); + UINFO(7, " Resolved recursive " << nodep + << endl); // Also prints taskp } else { nodep->v3error("Found definition of '" << m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".") diff --git a/src/V3Width.cpp b/src/V3Width.cpp index b616c10f6..46fcef797 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -4538,7 +4538,8 @@ private: // Grab width from the output variable (if it's a function) if (nodep->didWidth()) return; if (nodep->doingWidth()) { - nodep->v3warn(E_UNSUPPORTED, "Unsupported: Recursive function or task call"); + nodep->v3warn(E_UNSUPPORTED, "Unsupported: Recursive function or task call: " + << nodep->prettyNameQ()); nodep->dtypeSetBit(); nodep->didWidth(true); return; diff --git a/test_regress/t/t_func_recurse.out b/test_regress/t/t_func_recurse.out index 6d1b05195..81f9b9dde 100644 --- a/test_regress/t/t_func_recurse.out +++ b/test_regress/t/t_func_recurse.out @@ -1,5 +1,6 @@ -%Error-UNSUPPORTED: t/t_func_recurse.v:12:31: Unsupported: Recursive function call 'recurse_self' - 12 | else recurse_self = i + recurse_self(i - 1) * 2; - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_func_recurse.v:9:27: Unsupported: Recursive function or task call: 'recurse_self' + : ... In instance t + 9 | function automatic int recurse_self; + | ^~~~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: Exiting due to diff --git a/test_regress/t/t_func_recurse2.out b/test_regress/t/t_func_recurse2.out index 476d8791a..b93b57e47 100644 --- a/test_regress/t/t_func_recurse2.out +++ b/test_regress/t/t_func_recurse2.out @@ -1,4 +1,4 @@ -%Error-UNSUPPORTED: t/t_func_recurse2.v:9:27: Unsupported: Recursive function or task call +%Error-UNSUPPORTED: t/t_func_recurse2.v:9:27: Unsupported: Recursive function or task call: 'recurse_1' : ... In instance t 9 | function automatic int recurse_1; | ^~~~~~~~~ diff --git a/test_regress/t/t_func_recurse_param.out b/test_regress/t/t_func_recurse_param.out index f43ed155d..974986b7e 100644 --- a/test_regress/t/t_func_recurse_param.out +++ b/test_regress/t/t_func_recurse_param.out @@ -1,5 +1,6 @@ -%Error-UNSUPPORTED: t/t_func_recurse_param.v:12:31: Unsupported: Recursive function call 'recurse_self' - 12 | else recurse_self = i + recurse_self(i - 1) * 2; - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_func_recurse_param.v:9:27: Unsupported: Recursive function or task call: 'recurse_self' + : ... In instance t + 9 | function automatic int recurse_self; + | ^~~~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest %Error: Exiting due to diff --git a/test_regress/t/t_func_recurse_param_bad.out b/test_regress/t/t_func_recurse_param_bad.out index 44cf3059a..569ea6481 100644 --- a/test_regress/t/t_func_recurse_param_bad.out +++ b/test_regress/t/t_func_recurse_param_bad.out @@ -1,5 +1,7 @@ -%Error-UNSUPPORTED: t/t_func_recurse_param_bad.v:12:31: Unsupported: Recursive function call 'recurse_self' - 12 | else recurse_self = i + recurse_self(i - 1) * 2; - | ^~~~~~~~~~~~ +%Error-UNSUPPORTED: t/t_func_recurse_param_bad.v:9:27: Unsupported: Recursive function or task call: 'recurse_self' + : ... In instance t + 9 | function automatic int recurse_self; + | ^~~~~~~~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error: Exiting due to +%Error: Verilator internal fault, sorry. Suggest trying --debug --gdbbt +%Error: Command Failed