[Semantic][Select Rank] Semantic checks fails with fatal internal error

Hi Community,
I am trying to implement semantic checks for Select Rank (R1148) Construct.
I tried successfully C1150 constraint implementation.

For C1151 I am facing an issue as below,
$ f18 negative_rank.F90 -fdebug-semantics

fatal internal error: CHECK(x) failed at
~/Workspace/tool-chain/F18/f18/lib/semantics/tools.h(213)
Aborted (core dumped)

Debugging with GDB shows core dump in
GetIntValue(*i) Function, where the value of variable i, I suppose is
not an expression, which causes it to fail in
CHECK(x): in lib/semantics/tools.h

1)
Is there somthing fundamental I am missing in below function?
void ConstructVisitor::Post(const parser::SelectRankConstruct &)

2)
Is void ConstructVisitor::Post(const parser::SelectRankCaseStmt::Rank
&) a more appropriate function to do C1151 checks?

Below is the attached patch and program.

Thanks,
Sameeran