[gortran, PATCH] Fix PR 18937

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon Mar 26 19:53:00 GMT 2007


Toon Moene wrote:
> Tobias Schlüter wrote:
> 
>> Of course, life is not as simple as one would hope: in order to 
>> determine if a branch is valid we have to know if the branch target is 
>> an END {DO,SELECT,IF} statement (can someone point me to the relevant 
>> quote in the standard, I couldn't seem to find it.
> 
> Quoting the 2003 Standard:
> 
> IF statement (page 156-157):
> 
> An ELSE IF statement or an ELSE statement shall not be a branch target 
> statement.  It is permissible to branch to an END IF statement only from 
> with its IF construct.
> 
> CASE statement (page 159):
> 
> A CASE statement shall not be a branch target statement.  It is 
> permissible to branch to an [END SELECT statement] only from within its 
> CASE construct.
> 
> DO statement (page 167):
> 
> In a block DO construct, a transfer of control to the [END DO statement] 
> has the same effect as execution of a CYCLE statement belonging to that 
> construct.
> 
> (page 168):
> 
> (4) Transfer of control from a statement within the range of a DO
>     construct to a statement that is neither the [END DO statement]
>     nor within the range of the same DO construct [terminates the
>     loop].
> 
> I think I've got them all ...

Thanks, now that look over this I see that 8.2 has all this collected in 
one place.  Wonder how I missed this before.  Anyway, trying a few 
corner cases, I already found a weird preexisting bug and I see a few 
additional things I'll have to do.  Sigh, why aren't labels on 
statements that are not branch-target statements disallowed or at least 
deprecated?

Cheers,
- Tobi



More information about the Gcc-patches mailing list