Can a GOTO command refers to outside a subroutine?

Can a GOTO command refers to outside a subroutine?

Rasoul K.的头像

Is it possible to have a GOTO command inside a subroutine which points to outside the subroutine?
In a subroutine, I have the follo‌wing line:

IF(BN.GT.100000E+02) GOTO 1000

And there is no 1000 in that subroutine.

Another line in the same subroutine is:
GOTO 5000
There is no 5000 in the same subroutine but there are may 5000 in the main program.

It is sort of confusing for me but as the program is written by my professor, I can't easily say it is wrong.

Also if it possible, if there are more than 5000 in the main program, will it go to the next 5000 after call subroutine?

3 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

No. The branch target label needs to designate a statement in the same inclusive scope. A modern Fortran compiler must detect this and report an error. Are you sure that things are as you describe?

Rasoul K.的头像

引文:

IanH 写道:

No. The branch target label needs to designate a statement in the same inclusive scope. A modern Fortran compiler must detect this and report an error. Are you sure that things are as you describe?

Dear Ian.
You are correct. I had a mistake. I figured it out.
Sorry for fast decision, I should look completely before reporting.

登陆并发表评论。