public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44709]  New: BLOCK and GOTO/EXIT/CYCLE
@ 2010-06-29  8:46 burnus at gcc dot gnu dot org
  2010-06-29 20:04 ` [Bug fortran/44709] " burnus at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-29  8:46 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
@ 2010-06-29 20:04 ` burnus at gcc dot gnu dot org
  2010-07-04 11:48 ` domob at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-06-29 20:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2010-06-29 20:03 -------
As pointed out by Andrew: One should follow C++ and generate  try {} finally{}
blocks  (TRY_FINALLY_EXPR).


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
  2010-06-29 20:04 ` [Bug fortran/44709] " burnus at gcc dot gnu dot org
@ 2010-07-04 11:48 ` domob at gcc dot gnu dot org
  2010-07-07 13:05 ` domob at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-04 11:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from domob at gcc dot gnu dot org  2010-07-04 11:48 -------
Mine.


-- 

domob at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |domob at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-04 11:48:21
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
  2010-06-29 20:04 ` [Bug fortran/44709] " burnus at gcc dot gnu dot org
  2010-07-04 11:48 ` domob at gcc dot gnu dot org
@ 2010-07-07 13:05 ` domob at gcc dot gnu dot org
  2010-07-15 12:24 ` domob at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-07 13:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from domob at gcc dot gnu dot org  2010-07-07 13:05 -------
See http://gcc.gnu.org/ml/fortran/2010-07/msg00058.html.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-07 13:05 ` domob at gcc dot gnu dot org
@ 2010-07-15 12:24 ` domob at gcc dot gnu dot org
  2010-07-15 12:31 ` domob at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-15 12:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from domob at gcc dot gnu dot org  2010-07-15 12:24 -------
Subject: Bug 44709

Author: domob
Date: Thu Jul 15 12:23:47 2010
New Revision: 162219

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162219
Log:
2010-07-15  Daniel Kraft  <d@domob.eu>

        PR fortran/44709
        * trans.h (struct gfc_wrapped_block): New struct.
        (gfc_start_wrapped_block), (gfc_add_init_cleanup): New methods.
        (gfc_finish_wrapped_block): New method.
        (gfc_init_default_dt): Add new init code to block rather than
        returning it.
        * trans-array.h (gfc_trans_auto_array_allocation): Use
gfc_wrapped_block
        (gfc_trans_dummy_array_bias): Ditto.
        (gfc_trans_g77_array): Ditto.
        (gfc_trans_deferred_array): Ditto.
        * trans.c (gfc_add_expr_to_block): Call add_expr_to_chain.
        (add_expr_to_chain): New method based on old gfc_add_expr_to_block.
        (gfc_start_wrapped_block), (gfc_add_init_cleanup): New methods.
        (gfc_finish_wrapped_block): New method.
        * trans-array.c (gfc_trans_auto_array_allocation): use
gfc_wrapped_block
        (gfc_trans_g77_array), (gfc_trans_dummy_array_bias): Ditto.
        (gfc_trans_deferred_array): Ditto.
        * trans-decl.c (gfc_trans_dummy_character): Ditto.
        (gfc_trans_auto_character_variable), (gfc_trans_assign_aux_var): Ditto.
        (init_intent_out_dt): Ditto.
        (gfc_init_default_dt): Add new init code to block rather than
        returning it.
        (gfc_trans_deferred_vars): Use gfc_wrapped_block to collect all init
        and cleanup code and put it all together.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-array.h
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/fortran/trans.c
    trunk/gcc/fortran/trans.h


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-15 12:24 ` domob at gcc dot gnu dot org
@ 2010-07-15 12:31 ` domob at gcc dot gnu dot org
  2010-07-23  9:54 ` domob at gcc dot gnu dot org
  2010-07-23  9:55 ` domob at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-15 12:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from domob at gcc dot gnu dot org  2010-07-15 12:31 -------
Fixed the clean-up issues.  Still remaining is the rejects-valid (2b) of
Tobias' original comment.  I'll keep on with that.


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-15 12:31 ` domob at gcc dot gnu dot org
@ 2010-07-23  9:54 ` domob at gcc dot gnu dot org
  2010-07-23  9:55 ` domob at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-23  9:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from domob at gcc dot gnu dot org  2010-07-23 09:53 -------
Subject: Bug 44709

Author: domob
Date: Fri Jul 23 09:53:45 2010
New Revision: 162450

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162450
Log:
2010-07-23  Daniel Kraft  <d@domob.eu>

        PR fortran/44709
        * gfortran.h (gfc_find_symtree_in_proc): New method.
        * symbol.c (gfc_find_symtree_in_proc): New method.
        * match.c (match_exit_cycle): Look for loop name also in parent
        namespaces within current procedure.

2010-07-23  Daniel Kraft  <d@domob.eu>

        PR fortran/44709
        * gfortran.dg/exit_1.f08: New test.
        * gfortran.dg/exit_2.f08: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/exit_1.f08
    trunk/gcc/testsuite/gfortran.dg/exit_2.f08
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/match.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/44709] BLOCK and GOTO/EXIT/CYCLE
  2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-07-23  9:54 ` domob at gcc dot gnu dot org
@ 2010-07-23  9:55 ` domob at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-23  9:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from domob at gcc dot gnu dot org  2010-07-23 09:55 -------
Fixed.


-- 

domob at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-07-23  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29  8:46 [Bug fortran/44709] New: BLOCK and GOTO/EXIT/CYCLE burnus at gcc dot gnu dot org
2010-06-29 20:04 ` [Bug fortran/44709] " burnus at gcc dot gnu dot org
2010-07-04 11:48 ` domob at gcc dot gnu dot org
2010-07-07 13:05 ` domob at gcc dot gnu dot org
2010-07-15 12:24 ` domob at gcc dot gnu dot org
2010-07-15 12:31 ` domob at gcc dot gnu dot org
2010-07-23  9:54 ` domob at gcc dot gnu dot org
2010-07-23  9:55 ` domob at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).