public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct
@ 2009-04-03 14:49 domob at gcc dot gnu dot org
2009-04-03 16:43 ` [Bug fortran/39626] " steven at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-04-03 14:49 UTC (permalink / raw)
To: gcc-bugs
The upcoming Fortran 2008 standard introduces the BLOCK construct which allows
to declare local variables with a limited scope inside a procedure.
This is not yet implemented by gfortran. Some ideas and discussion here:
http://gcc.gnu.org/ml/fortran/2009-04/msg00003.html
--
Summary: Fortran 2008: Implement BLOCK construct
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: domob at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Fortran 2008: Implement BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
@ 2009-04-03 16:43 ` steven at gcc dot gnu dot org
2009-08-30 10:00 ` domob at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-04-03 16:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from steven at gcc dot gnu dot org 2009-04-03 16:43 -------
This feature requires a substantial re-work of symbol handling in gfortran
(make it block based).
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-04-03 16:43:38
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Fortran 2008: Implement BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
2009-04-03 16:43 ` [Bug fortran/39626] " steven at gcc dot gnu dot org
@ 2009-08-30 10:00 ` domob at gcc dot gnu dot org
2009-09-10 19:10 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-08-30 10:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from domob at gcc dot gnu dot org 2009-08-30 10:00 -------
I'm not sure it needs really that much changes... After all, the semantics can
probably be simulated completely via replacing the BLOCK-constructs with
contained procedures that are called where the BLOCK originally was?
That's of course not a nice implementation and I do not think we should
actually do this, but I believe that there needs not be that much change --
I'll work on this and try to find out a good way.
--
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|NEW |ASSIGNED
Last reconfirmed|2009-04-03 16:43:38 |2009-08-30 10:00:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Fortran 2008: Implement BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
2009-04-03 16:43 ` [Bug fortran/39626] " steven at gcc dot gnu dot org
2009-08-30 10:00 ` domob at gcc dot gnu dot org
@ 2009-09-10 19:10 ` burnus at gcc dot gnu dot org
2009-09-28 14:49 ` domob at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-09-10 19:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2009-09-10 19:10 -------
See also
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/ee95b68bf0658433#
Especially about the fine points raised by Richard Maine
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Fortran 2008: Implement BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-09-10 19:10 ` burnus at gcc dot gnu dot org
@ 2009-09-28 14:49 ` domob at gcc dot gnu dot org
2009-09-29 7:43 ` domob at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-09-28 14:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from domob at gcc dot gnu dot org 2009-09-28 14:49 -------
For a "basically workig" (i.e. without some of the finer details and ugly
corner cases, but handling all I would "reasonably" expect as user) patch, see
http://gcc.gnu.org/ml/fortran/2009-09/msg00255.html.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Fortran 2008: Implement BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-09-28 14:49 ` domob at gcc dot gnu dot org
@ 2009-09-29 7:43 ` domob at gcc dot gnu dot org
2009-09-29 7:49 ` [Bug fortran/39626] Correctly implement details of Fortran 2008 " domob at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-09-29 7:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from domob at gcc dot gnu dot org 2009-09-29 07:43 -------
Subject: Bug 39626
Author: domob
Date: Tue Sep 29 07:42:42 2009
New Revision: 152266
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152266
Log:
2009-09-29 Daniel Kraft <d@domob.eu>
PR fortran/39626
* gfortran.h (enum gfc_statement): Add ST_BLOCK and ST_END_BLOCK.
(struct gfc_namespace): Convert flags to bit-fields and add flag
`construct_entities' for use with BLOCK constructs.
(enum gfc_exec_code): Add EXEC_BLOCK.
(struct gfc_code): Add namespace field to union for EXEC_BLOCK.
* match.h (gfc_match_block): New prototype.
* parse.h (enum gfc_compile_state): Add COMP_BLOCK.
* trans.h (gfc_process_block_locals): New prototype.
(gfc_trans_deferred_vars): Made public, new prototype.
* trans-stmt.h (gfc_trans_block_construct): New prototype.
* decl.c (gfc_match_end): Handle END BLOCK correctly.
(gfc_match_intent): Error if inside of BLOCK.
(gfc_match_optional), (gfc_match_value): Ditto.
* match.c (gfc_match_block): New routine.
* parse.c (decode_statement): Handle BLOCK statement.
(case_exec_markers): Add ST_BLOCK.
(case_end): Add ST_END_BLOCK.
(gfc_ascii_statement): Handle ST_BLOCK and ST_END_BLOCK.
(parse_spec): Check for statements not allowed inside of BLOCK.
(parse_block_construct): New routine.
(parse_executable): Parse BLOCKs.
(parse_progunit): Disallow CONTAINS in BLOCK constructs.
* resolve.c (is_illegal_recursion): Find real container procedure and
don't get confused by BLOCK constructs.
(resolve_block_construct): New routine.
(gfc_resolve_blocks), (resolve_code): Handle EXEC_BLOCK.
* st.c (gfc_free_statement): Handle EXEC_BLOCK statements.
* trans-decl.c (saved_local_decls): New static variable.
(add_decl_as_local): New routine.
(gfc_finish_var_decl): Add variable as local if inside BLOCK.
(gfc_trans_deferred_vars): Make public.
(gfc_process_block_locals): New routine.
* trans-stmt.c (gfc_trans_block_construct): New routine.
* trans.c (gfc_trans_code): Handle EXEC_BLOCK statements.
2009-09-29 Daniel Kraft <d@domob.eu>
PR fortran/39626
* gfortran.dg/block_1.f08: New test.
* gfortran.dg/block_2.f08: New test.
* gfortran.dg/block_3.f90: New test.
* gfortran.dg/block_4.f08: New test.
* gfortran.dg/block_5.f08: New test.
* gfortran.dg/block_6.f08: New test.
* gfortran.dg/block_7.f08: New test.
* gfortran.dg/block_8.f08: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/block_1.f08
trunk/gcc/testsuite/gfortran.dg/block_2.f08
trunk/gcc/testsuite/gfortran.dg/block_3.f90
trunk/gcc/testsuite/gfortran.dg/block_4.f08
trunk/gcc/testsuite/gfortran.dg/block_5.f08
trunk/gcc/testsuite/gfortran.dg/block_6.f08
trunk/gcc/testsuite/gfortran.dg/block_7.f08
trunk/gcc/testsuite/gfortran.dg/block_8.f08
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/fortran/gfortran.h
trunk/gcc/fortran/match.c
trunk/gcc/fortran/match.h
trunk/gcc/fortran/parse.c
trunk/gcc/fortran/parse.h
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/st.c
trunk/gcc/fortran/trans-decl.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/fortran/trans-stmt.h
trunk/gcc/fortran/trans.c
trunk/gcc/fortran/trans.h
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Correctly implement details of Fortran 2008 BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-09-29 7:49 ` [Bug fortran/39626] Correctly implement details of Fortran 2008 " domob at gcc dot gnu dot org
@ 2009-09-29 7:49 ` domob at gcc dot gnu dot org
2010-02-10 18:26 ` domob at gcc dot gnu dot org
2010-02-17 21:52 ` burnus at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-09-29 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from domob at gcc dot gnu dot org 2009-09-29 07:49 -------
Also, Tobias mentioned (in the linked thread):
The patch looks good to me. It sometimes makes the diagnostics less
useful, e.g. for
recursive function func(i)
integer :: i, func
func = 1
entry func2(i)
block
func2 = func(1)
end block
end function func
But the same "Unclassifiable statement" one gets if one not only removes
"(end )block" but also "recursive".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Correctly implement details of Fortran 2008 BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-09-29 7:43 ` domob at gcc dot gnu dot org
@ 2009-09-29 7:49 ` domob at gcc dot gnu dot org
2009-09-29 7:49 ` domob at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2009-09-29 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from domob at gcc dot gnu dot org 2009-09-29 07:48 -------
Committed my patch linked above. This implements "basic" BLOCK support (what I
as a user would reasonably expect it to behave) but misses a lot of finer
details; I'll keep the PR open for those.
See my mailing list message for more information, but what I've got in mind for
still missing stuff:
* handle VOLATILE and ASYNCHRONOUS as the draft standard mentions
* implement the clause requiring SAVE to not reference a common-name
* do more stuff with regards to 'construct entities' rather than "ordinary
variables", for instance the IMPLICIT handling Richard Maine mentioned in his
c.l.f post which is also the XFAIL'ed test-case block_7.f08
--
domob at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Fortran 2008: Implement |Correctly implement details
|BLOCK construct |of Fortran 2008 BLOCK
| |construct
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Correctly implement details of Fortran 2008 BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-09-29 7:49 ` domob at gcc dot gnu dot org
@ 2010-02-10 18:26 ` domob at gcc dot gnu dot org
2010-02-17 21:52 ` burnus at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-02-10 18:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from domob at gcc dot gnu dot org 2010-02-10 18:26 -------
*** Bug 43019 has been marked as a duplicate of this bug. ***
--
domob at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/39626] Correctly implement details of Fortran 2008 BLOCK construct
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
` (7 preceding siblings ...)
2010-02-10 18:26 ` domob at gcc dot gnu dot org
@ 2010-02-17 21:52 ` burnus at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-17 21:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from burnus at gcc dot gnu dot org 2010-02-17 21:52 -------
See also http://j3-fortran.org/doc/meeting/191/10-126.txt
("Scoping unit fixes for BLOCK construct")
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39626
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2010-02-17 21:52 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-03 14:49 [Bug fortran/39626] New: Fortran 2008: Implement BLOCK construct domob at gcc dot gnu dot org
2009-04-03 16:43 ` [Bug fortran/39626] " steven at gcc dot gnu dot org
2009-08-30 10:00 ` domob at gcc dot gnu dot org
2009-09-10 19:10 ` burnus at gcc dot gnu dot org
2009-09-28 14:49 ` domob at gcc dot gnu dot org
2009-09-29 7:43 ` domob at gcc dot gnu dot org
2009-09-29 7:49 ` [Bug fortran/39626] Correctly implement details of Fortran 2008 " domob at gcc dot gnu dot org
2009-09-29 7:49 ` domob at gcc dot gnu dot org
2010-02-10 18:26 ` domob at gcc dot gnu dot org
2010-02-17 21:52 ` burnus 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).