This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jun 2010 08:46:20 -0000
- Subject: [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I think at least some of the following block-leaving statements are valid,
probably all. Besides some issues of the type 'rejects valid' there is a big
wrong-code question:
The allocatable objects need to be freed and derived types finalized when one
leaves the scope of the block. How to handle this? As the example shows, there
are many jump targets. Maybe one has to do something like
if (cond)
savelabel = L.1
goto clean_up_and_jump
goto end:
clean_up_and_jump:
cleanup
goto target
end:
cleanup
Or something similar...
Example:
outer: block
doloop: do i = 1, 4
inner: block
integer, allocatable :: a
allocate(a)
a = i
if(i == 1) cycle ! (1) - wrong-code: no dealloc
if(i == 2) exit ! (2a)- wrong-code: no dealloc
if(i == 2) exit doloop ! (2b)- rejects-valid: label not found
if(i == 3) exit inner ! (3) - PR 44602
if(i == 4) exit outer ! (4) - PR 44602
if(i == 5) goto 111 ! (5) - wrong-code: no dealloc
end block inner
end do doloop
end block outer
111 continue
end
(1) and (5) is accepted by gfortran, (2) is only accepted without the label
("Name 'doloop' in EXIT statement at (1) is not a loop name"). (3) and (4) are
constructs not yet supported, cf. PR 44602.
--
Summary: BLOCK and GOTO/EXIT/CYCLE
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: wrong-code, rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 44602
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44709