What is the point of this?
As far as I can see if there are errors then this creates a format structure, yet at no point is this reference 201 used anywhere?!
if(ierror /= 0) then
201 format(7f10.5,2i2)
endif
UPDATE: I should state that I have only seen the format
command used in reference to the write
command and there is no write
command in this subroutine at all. I am just concerned that I am missing another nuance of the format
command, before I just delete this pointless selection.
1 Like
Often one inserts some debugging code and later removes it but fails to remove all of it. I’d guess that happened here. To avoid this, it’s good to compile with options such as gfortran -Werror=unused-label
. If you compile code with gfortran -Wall -Wextra
and get a message such as
1 | 201 format(7f10.5,2i2)
| 1
Warning: Label 201 at (1) defined but not used [-Wunused-label]
then that line can be removed.
1 Like
Just for completeness, I’ll mention that FORMAT statements may appear almost anywhere in a program unit (after USE and IMPORT, before CONTAINS.) It’s most common to have them either near the I/O statement using the format or at the end of the program unit. I agree with the others that this was likely a vestige of other code removed.
4 Likes
Yes, I removed these from the code and it had zero impact; as thought.
Thank you.