View previous topic :: View next topic |
Author |
Message |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sun Jul 31, 2016 11:18 am Post subject: Warning 298 |
|
|
Code: | SUBROUTINE TestInquire (NFIL)
IMPLICIT NONE
INTEGER, INTENT(IN) :: NFIL
INTEGER MXSAL, LP
!! MXSAL = 0
INQUIRE (UNIT= NFIL, RECL= MXSAL)
LP = MXSAL+1
LP = LP
RETURN
END
|
Why does this code provide
warnig 298 Variable MXSAL has been used without being given an initial value?
If I change UNIT= NFIL against e.g. FILE= 'xx.dat', I get the same warning. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Sun Jul 31, 2016 4:18 pm Post subject: |
|
|
It's because ! signifies 'Comment', and you commented out the assignment statement ... |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sun Jul 31, 2016 5:36 pm Post subject: |
|
|
Litus,
this is unqualified response! MXSAL = 0 should not be necessary. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Mon Aug 01, 2016 6:55 am Post subject: |
|
|
It is bug in FTN95 and I have made a note that it needs fixing. |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Wed Aug 03, 2016 5:30 am Post subject: |
|
|
A 'bug' it may be considered to be, however, it's invariably good practice to initialise ALL variables in a program ... init !!! |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Wed Aug 03, 2016 7:42 am Post subject: |
|
|
John,
in this case the variable MXSAL shoul be initialized by INQUIRE !
Erwin |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Thu Jan 26, 2017 12:13 pm Post subject: |
|
|
This has now been fixed for the next release. |
|
Back to top |
|
|
|