chipsalliance / chipsalliance/Surelog
Deep recursion when running LoopParamOver test ?
- Dominant language
- C++
- Stars
- 475
- Forks
- 90
- Avg merge
- 1h 39m
- Merged PRs (30d)
- 37
Description
The `LoopParamOver` test crashes when running in debug mode or address sanitizer mode due to a very deep stack, which looks like a super-deep recursion (see below).
It might not show up in optimized mode as the stack-frames are probably smaller.
But given that the input is:
```SystemVerilog
module Foo ();
parameter P1 = 10;
parameter P2 = P1 + P2;
endmodule
module top();
parameter P3 = P1;
parameter P2 = P3;
parameter P1 = P2;
Foo #(.P1(P2)) sub();
endmodule
```
... it is unclear where the deep recursion of more than 1000 frames is coming from
```
*** SIGSEGV (@0x7fffda3ee400) ***
PC: @ 0x56438cb460a5 (unknown) UHDM::ExprEval::reduceExpr()
@ 0x564390160598 256 FailureSignalHandler()
@ 0x7fdae39eb1c0 (unknown) (unknown)
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ 0x56438c45c7d3 1840 SURELOG::CompileHelper::getValue()
@ 0x56438c48a380 80 std::__u::__function::__policy_invoker<>::__call_impl<>()
@ 0x56438cb4475f 352 UHDM::ExprEval::getValue()
@ 0x56438cb468f0 12352 UHDM::ExprEval::reduceExpr()
@ 0x56438c459f7d 1056 SURELOG::CompileHelper::reduceExpr()
@ ... and at least 1000 more frames
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the LoopParamOver test in debug or address sanitizer mode with the provided SystemVerilog input. Trace the repeated calls through UHDM::ExprEval::reduceExpr(), SURELOG::CompileHelper::reduceExpr(), and SURELOG::CompileHelper::getValue(). Done means the test no longer crashes from deep recursion and the behavior for this input is handled appropriately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100