The best solution is wanted.

The best solution is wanted.

How to make this code better in Fortran 2003?

IF A == 1 THEN 
(STATEMENTS)
 IF B == 1 GOTO 100 
ELSE IF B == 1 THEN 
(STATEMENTS) 
IF C == 1 GOTO 100 
ELSE IF C == 1 THEN 
(STATEMENTS) 
IF D == 1 GOTO 100 
ELSE IF D == 1 THEN
 (STATEMENTS)
 IF E == 1 GOTO 100 
ELSE IF E == 1 THEN 
(STATEMENTS) 
IF F == 1 GOTO 100 
ELSE IF F == 1 THEN 
(STATEMENTS) … ELSE 
IF Y == 1 THEN 
(STATEMENTS)
 IF Z == 1 GOTO 100
 … 
100 …

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
mecej4's picture

If the statement with number 100 occurs immediately after the IF...END IF block, all the statements similar to and including IF(B == 1) GOTO 100 are superfluous.

.NOT.(100 occurs immediately after the IF...END IF block)

Repeat Offender's picture

Check the logic in lines 03:04 and repost.

Login to leave a comment.