variable is not defined in the current scope?

Hello

I am debugging my Fortran code using pgdbg. When I check one variable, it said “is not defined in the current scope”. But apparently it is defined. why?
I pasted my code below. The variable is “xhu_VAR”. For other variables, I can check their values with no problem.

SUBROUTINE racm_INTEGRATE( TIN, TOUT, &
FIX, xhu_VAR, RCONST, ATOL, RTOL, &
ICNTRL_U, RCNTRL_U, ISTATUS_U, RSTATUS_U, IERR_U )
USE racm_Parameters
IMPLICIT NONE
REAL(kind=dp), INTENT(INOUT), DIMENSION(NFIX) :: FIX
REAL(kind=dp), INTENT(INOUT), DIMENSION(NVAR) :: xhu_VAR
REAL(kind=dp), INTENT(IN), DIMENSION(NSPEC) :: ATOL, RTOL
REAL(kind=dp), INTENT(IN), DIMENSION(NREACT) :: RCONST
REAL(kind=dp), INTENT(IN) :: TIN
REAL(kind=dp), INTENT(IN) :: TOUT
INTEGER, INTENT(IN), OPTIONAL :: ICNTRL_U(20)
REAL(kind=dp), INTENT(IN), OPTIONAL :: RCNTRL_U(20)
INTEGER, INTENT(OUT), OPTIONAL :: ISTATUS_U(20)
REAL(kind=dp), INTENT(OUT), OPTIONAL :: RSTATUS_U(20)
INTEGER, INTENT(OUT), OPTIONAL :: IERR_U
REAL(kind=dp) :: STEPMIN
INTEGER :: N_stp, N_acc, N_rej, N_sng
SAVE N_stp, N_acc, N_rej, N_sng
INTEGER :: i, IERR
REAL(kind=dp) :: RCNTRL(20), RSTATUS(20)
INTEGER :: ICNTRL(20), ISTATUS(20)
ICNTRL(:) = 0
RCNTRL(:) = 0.0_dp
ISTATUS(:) = 0
RSTATUS(:) = 0.0_dp
IF (PRESENT(ICNTRL_U)) THEN
WHERE(ICNTRL_U(:) > 0) ICNTRL(:) = ICNTRL_U(:)
END IF
IF (PRESENT(RCNTRL_U)) THEN
WHERE(RCNTRL_U(:) > 0) RCNTRL(:) = RCNTRL_U(:)
END IF
CALL racm_Rosenbrock(xhu_VAR, FIX, RCONST, TIN,TOUT, &
ATOL,RTOL, &
RCNTRL,ICNTRL,RSTATUS,ISTATUS,IERR)
STEPMIN = RCNTRL(ihexit)
IF (PRESENT(ISTATUS_U)) ISTATUS_U(:) = ISTATUS(:)
IF (PRESENT(RSTATUS_U)) RSTATUS_U(:) = RSTATUS(:)
IF (PRESENT(IERR_U)) IERR_U = IERR
END SUBROUTINE racm_INTEGRATE

Hi yuanfangcan,

I asked one our tool engineers to take a look but unfortunately, he was unable to recreate the reported behavior using this code snip-it. Do you mind sending PGI Customer Service (trs@pgroup.com) a reproducible example?

Thanks,
Mat

Hi yuanfangcan,

Did you compile the code with the flag -g ?
I missed it last time and got the similar message…^^a
Maybe you can check it.