This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/41781] [OOP] bogus undefined label error with SELECT TYPE.



------- Comment #4 from burnus at gcc dot gnu dot org  2009-10-21 14:07 -------
While for
  goto 99
  if(.true.) then
  99 continue
  end if
  end
one gets (for if, do, select case) the nice warning (!) message:
  Warning: Label at (1) is not in the same block as the GOTO statement at (2)

One gets for
  goto 99
  block
    99 continue
  end block
  end
only:
  Error: Label 99 referenced at (1) is never defined

I think something nicer than "never defined" would be useful. One has also to
think about which of those should give a warning (like now) and which should
give a hard error.


I believe jumping *into* a (DO/IF/SELECT (TYPE/CASE)/BLOCK/ ...) block is
invalid, but they are all in the same scoping unit. However, I failed to find
this restriction.

The standard has:

R851 goto-stmt is GO TO label
C846 (R851) The label shall be the statement label of a branch target
            statement that appears in the same scoping unit as the goto-stmt.

1.3.115 scoping unit
either
- a program unit or subprogram, excluding any scoping units in it,
- a derived-type denition (4.5.2), or
- an interface body, excluding any scoping units in it

Further restrictions (and some more related to branching to an END <x> only
from inside of the <x>):

C734 (R744) A statement that is part of a where-body-construct shall not be a
branch target statement.

C743 (R756) A forall-body-construct shall not be a branch target.

It is permissible to branch to an end-associate-stmt only from within its
ASSOCIATE construct.

C811 A statement that branches from the block of a critical-construct to
outside the critical-construct is not permitted. A CYCLE or EXIT statement in a
critical-construct that transfers control outside the critical-construct is not
permitted.

It is permitted to branch to the end-do of a block DO construct only from
within the range of that DO construct.

C824 A branch (8.2) within a DO CONCURRENT construct shall not have a branch
target that is outside the construct.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41781


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]