Can a GOTO command refers to outside a subroutine?

Can a GOTO command refers to outside a subroutine?

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 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

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?

Citation :

IanH a écrit :

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.

Connectez-vous pour laisser un commentaire.