"W_HADV_TVD" compilation problem

When cpp defines W_HADV_TVD and W_VADV_TVD, compilation fails in v2.0.0.
But it can be compiled successfully in v1.3.1.
How can I modify to compile successfully? Thank you.

ps:ubuntu 20.04+gfortran

The compilation error message is as follows:
#---------------------------------------------------------------------------------
mpif90 -c -O2 -mcmodel=medium -fdefault-real-8 -fdefault-double-8 -std=legacy -I/usr/include step3d_fast_.f -o step3d_fast.o
step3d_fast_.f:1374:24:

1371 | do k=1,N
| 2

1374 | dZdxq_u(i,j,k)=(z_r(i,j,k)-z_r(i-1,j,k))
| 1
Warning: Array reference at (1) out of bounds (40 > 2) in loop beginning at (2)
step3d_fast_.f:1390:53:

1386 | do k=1,N-1
| 2

1390 | & *(dZdxq_u(i,j,k)+
| 1
Warning: Array reference at (1) out of bounds (39 > 2) in loop beginning at (2)
step3d_fast_.f:1391:53:

1386 | do k=1,N-1
| 2

1391 | & dZdxq_u(i,j,k+1))
| 1
Warning: Array reference at (1) out of bounds (40 > 2) in loop beginning at (2)
step3d_fast_.f:1424:24:

1421 | do k=1,N
| 2

1424 | dZdyq_v(i,j,k)=(z_r(i,j,k)-z_r(i,j-1,k))
| 1
Warning: Array reference at (1) out of bounds (40 > 2) in loop beginning at (2)
step3d_fast_.f:1440:47:

1436 | do k=1,N-1
| 2

1440 | & *(dZdyq_v(i,j,k)+
| 1
Warning: Array reference at (1) out of bounds (39 > 2) in loop beginning at (2)
step3d_fast_.f:1441:47:

1436 | do k=1,N-1
| 2

1441 | & dZdyq_v(i,j,k+1))
| 1
Warning: Array reference at (1) out of bounds (40 > 2) in loop beginning at (2)
cpp -traditional -DLinux -P -I/usr/include -ICROCOFILES/AGRIF_INC step3d_w.F > step3d_w_.f1
python3 ./change_loops.py step3d_w_.f1 step3d_w_.tmp
cat step3d_w_.tmp | ./mpc > step3d_w_.f && \rm step3d_w_.tmp
mpif90 -c -O2 -mcmodel=medium -fdefault-real-8 -fdefault-double-8 -std=legacy -I/usr/include step3d_w_.f -o step3d_w.o
cpp -traditional -DLinux -P -I/usr/include -ICROCOFILES/AGRIF_INC rhs3d_w_nh.F > rhs3d_w_nh_.f1
python3 ./change_loops.py rhs3d_w_nh_.f1 rhs3d_w_nh_.tmp
cat rhs3d_w_nh_.tmp | ./mpc > rhs3d_w_nh_.f && \rm rhs3d_w_nh_.tmp
mpif90 -c -O2 -mcmodel=medium -fdefault-real-8 -fdefault-double-8 -std=legacy -I/usr/include rhs3d_w_nh_.f -o rhs3d_w_nh.o
rhs3d_w_nh_.f:626:15:

626 | WFx(i,j)=0.5D0*( wz(i,j,k,nrhs)+wz(i-1,j,k,nrhs)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:651:30:

651 | Cr=limiter2(cu,WFx(i,j),cff1,rrm,rr,rrp)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:652:15:

652 | WFx(i,j) = (1-Cr)cff1 + Cr WFx(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:652:44:

652 | WFx(i,j) = (1-Cr)cff1 + Cr WFx(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:673:30:

673 | Cr=limiter2(cu,WFx(i,j),cff1,rrm,rr,rrp)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:674:15:

674 | WFx(i,j) = (1-Cr)cff1 + Cr WFx(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:674:44:

674 | WFx(i,j) = (1-Cr)cff1 + Cr WFx(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:696:30:

696 | Cr=limiter2(cu,WFx(i,j),cff1,rrm,rr,rrp)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:697:15:

697 | WFx(i,j) = (1-Cr)cff1 + Cr WFx(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:697:44:

697 | WFx(i,j) = (1-Cr)cff1 + Cr WFx(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:701:15:

701 | WFe(i,j)=0.5D0*( Wz(i,j,k,nrhs)+Wz(i,j-1,k,nrhs)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:726:30:

726 | Cr=limiter2(cu,WFe(i,j),cff1,rrm,rr,rrp)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:727:15:

727 | WFe(i,j) = (1-Cr)cff1 + Cr WFe(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:727:45:

727 | WFe(i,j) = (1-Cr)cff1 + Cr WFe(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:750:30:

750 | Cr=limiter2(cu,WFe(i,j),cff1,rrm,rr,rrp)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:751:15:

751 | WFe(i,j) = (1-Cr)cff1 + Cr WFe(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
rhs3d_w_nh_.f:751:45:

751 | WFe(i,j) = (1-Cr)cff1 + Cr WFe(i,j)
| 1
Error: Rank mismatch in array reference at (1) (2/3)
make: *** [Makedefs:15: rhs3d_w_nh.o] Error 1
#---------------------------------------------------------------------------------

#Using W_HADV_WENO5 and W_VADV_WENO5 instead of W_HADV_TVD and W_VADV_TVD can result in successful compilation in v1.3.1 and v2.0.0.