Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

CVF: Some variables have "Undefined address"

caroline_r
Beginner
604 Views

And here's the Fortran implementation of FILETEST. DATADIR is fine; OUTDIR and FTSTATUS are the two with "Undefined address."
SUBROUTINE FILETEST (DATADIR, OUTDIR, FTSTATUS)

USE DFPORT
USE DFLIB

CHARACTER*100, INTENT(IN) :: DATADIR
CHARACTER*100, INTENT(INOUT) :: OUTDIR
INTEGER, INTENT(INOUT)      :: FTSTATUS

CHARACTER*100               :: cwd, cwd1, command
INTEGER                     :: istat, istat2

istat = GETCWD(cwd1)
istat = CHANGEDIRQQ(DATADIR)
istat = GETCWD(cwd)

OPEN (unit=17, file='fjksd.txt', iostat=istat, status='unknown')

if (istat.eq.0) then
OUTDIR = TRIM(DATADIR) // CHAR(0)
close (17)
istat2 = DELFILESQQ('fjksd.txt')
FTSTATUS = istat
go to 119
else if (istat.gt.0) then
FTSTATUS = istat
close (17)

CALL PROMPT_OUTDIR(OUTDIR)

OUTDIR = TRIM(OUTDIR) // CHAR(0)
endif

119		istat = CHANGEDIRQQ(cwd1)

RETURN

END SUBROUTINE FILETEST
0 Kudos
2 Replies
greldak
Beginner
604 Views
Have you defined OUTDIR and FTSTATUS prior to calling FILETEST - if not then they will be undefined.
Incidently looking at your code I can't see why you set INTENT to INOUT for these arguments, OUT looks to be more appropriate and may well avoid the issue as then you will then not expect a value for either variable on routine entry.
0 Kudos
caroline_r
Beginner
604 Views
Well, OUTDIR and FTSTATUS are initialized in the C++ main portion, just as DATADIR is.
I'll try setting INTENT(OUT) and see if that helps -- I thought I had already tried that but my memory may be failing me.
Thanks.
0 Kudos
Reply