[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936 --- Comment #18 from Daniel Kraft 2010-10-12 13:37:44 UTC --- This commit did implement better handling for association to derived-types, but some cases are still not handled (see the XFAIL of associate_9.f03). I wanted to test with the code of PR 45369, but that also uses CLASS(*) so I was not able to compile it still. See http://gcc.gnu.org/ml/fortran/2010-10/msg00126.html for some discussion about what's still missing for derived-types, and in addition there's still proper handling of strings open (as in the commented-out section of associate_1.f03).
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936 --- Comment #17 from Daniel Kraft 2010-10-12 13:30:57 UTC --- Author: domob Date: Tue Oct 12 13:30:53 2010 New Revision: 165378 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165378 Log: 2010-10-12 Daniel Kraft PR fortran/38936 * parse.c (parse_associate): Set typespec of associate-name if that of the target is already available. 2010-10-12 Daniel Kraft PR fortran/38936 * gfortran.dg/associate_1.f03: More tests with derived-types. * gfortran.dg/associate_9.f03: New test (XFAIL for now). * gfortran.dg/associate_8.f03: Fix typo. * gfortran.dg/initialization_27.f90: Fix typo. Added: trunk/gcc/testsuite/gfortran.dg/associate_9.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/parse.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/associate_1.f03 trunk/gcc/testsuite/gfortran.dg/associate_8.f03 trunk/gcc/testsuite/gfortran.dg/initialization_27.f90
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #15 from domob at gcc dot gnu dot org 2010-09-23 08:38 --- Subject: Bug 38936 Author: domob Date: Thu Sep 23 08:37:54 2010 New Revision: 164550 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164550 Log: 2010-09-23 Daniel Kraft PR fortran/38936 PR fortran/44044 PR fortran/45474 * gfortran.h (gfc_check_vardef_context): New method. (struct symbol_attribute): New flag `select_type_temporary'. * primary.c (gfc_variable_attr): Clarify initialization of ref. (match_variable): Remove PROTECTED check and assignment check for PARAMETERs (this is now done later). * match.c (gfc_match_iterator): Remove INTENT(IN) check. (gfc_match_associate): Defer initialization of newAssoc->variable. (gfc_match_nullify): Remove PURE definability check. (select_type_set_tmp): Set new `select_type_temporary' flag. * expr.c (gfc_check_assign): Remove INTENT(IN) check here. (gfc_check_pointer_assign): Ditto (and other checks removed). (gfc_check_vardef_context): New method. * interface.c (compare_parameter_protected): Removed. (compare_actual_formal): Use `gfc_check_vardef_context' for checks related to INTENT([IN]OUT) arguments. * intrinsic.c (check_arglist): Check INTENT for intrinsics. * resolve.c (gfc_resolve_iterator): Use `gfc_check_vardef_context'. (remove_last_array_ref): New method. (resolve_deallocate_expr), (resolve_allocate_expr): Ditto. (resolve_allocate_deallocate): Ditto (for STAT and ERRMSG). (resolve_assoc_var): Remove checks for definability here. (resolve_select_type): Handle resolving of code->block here. (resolve_ordinary_assign): Remove PURE check. (resolve_code): Do not resolve code->blocks for SELECT TYPE here. Use `gfc_check_vardef_context' for assignments and pointer-assignments. 2010-09-23 Daniel Kraft PR fortran/38936 PR fortran/44044 PR fortran/45474 * gfortran.dg/intrinsic_intent_1.f03: New test. * gfortran.dg/select_type_17.f03: New test. * gfortran.dg/associate_5.f03: More definability tests. * gfortran.dg/enum_2.f90: Check definability. * gfortran.dg/allocatable_dummy_2.f90: Change expected error message. * gfortran.dg/allocate_alloc_opt_2.f90: Ditto. * gfortran.dg/char_expr_2.f90: Ditto. * gfortran.dg/deallocate_alloc_opt_2.f90: Ditto. * gfortran.dg/enum_5.f90: Ditto. * gfortran.dg/equiv_constraint_8.f90: Ditto. * gfortran.dg/impure_assignment_2.f90: Ditto. * gfortran.dg/impure_assignment_3.f90: Ditto. * gfortran.dg/intent_out_1.f90: Ditto. * gfortran.dg/intent_out_3.f90: Ditto. * gfortran.dg/pointer_assign_7.f90: Ditto. * gfortran.dg/pointer_intent_3.f90: Ditto. * gfortran.dg/pr19936_1.f90: Ditto. * gfortran.dg/proc_ptr_comp_3.f90: Ditto. * gfortran.dg/simpleif_2.f90: Ditto. * gfortran.dg/protected_5.f90: Ditto. * gfortran.dg/protected_4.f90: Ditto and remove invalid error check. * gfortran.dg/protected_6.f90: Ditto. * gfortran.dg/protected_7.f90: Ditto. Added: trunk/gcc/testsuite/gfortran.dg/intrinsic_intent_1.f03 trunk/gcc/testsuite/gfortran.dg/select_type_17.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/expr.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/interface.c trunk/gcc/fortran/intrinsic.c trunk/gcc/fortran/match.c trunk/gcc/fortran/primary.c trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90 trunk/gcc/testsuite/gfortran.dg/allocate_alloc_opt_2.f90 trunk/gcc/testsuite/gfortran.dg/associate_5.f03 trunk/gcc/testsuite/gfortran.dg/char_expr_2.f90 trunk/gcc/testsuite/gfortran.dg/deallocate_alloc_opt_2.f90 trunk/gcc/testsuite/gfortran.dg/enum_2.f90 trunk/gcc/testsuite/gfortran.dg/enum_5.f90 trunk/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90 trunk/gcc/testsuite/gfortran.dg/impure_assignment_2.f90 trunk/gcc/testsuite/gfortran.dg/impure_assignment_3.f90 trunk/gcc/testsuite/gfortran.dg/intent_out_1.f90 trunk/gcc/testsuite/gfortran.dg/intent_out_3.f90 trunk/gcc/testsuite/gfortran.dg/pointer_assign_7.f90 trunk/gcc/testsuite/gfortran.dg/pointer_intent_3.f90 trunk/gcc/testsuite/gfortran.dg/pr19936_1.f90 trunk/gcc/testsuite/gfortran.dg/proc_ptr_comp_3.f90 trunk/gcc/testsuite/gfortran.dg/protected_4.f90 trunk/gcc/testsuite/gfortran.dg/protected_5.f90 trunk/gcc/testsuite/gfortran.dg/protected_6.f90 trunk/gcc/testsuite/gfortran.dg/protected_7.f90 trunk/gcc/testsuite/gfortran.dg/simpleif_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #14 from domob at gcc dot gnu dot org 2010-08-26 19:54 --- This fixed association to CLASS entities and also reworked SELECT TYPE to use the same workings internally. Still open: Association to strings and derived-types, and the extended checks for illegal usage of names associated to expressions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #13 from domob at gcc dot gnu dot org 2010-08-26 19:49 --- Subject: Bug 38936 Author: domob Date: Thu Aug 26 19:48:43 2010 New Revision: 163572 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163572 Log: 2010-08-26 Daniel Kraft PR fortran/38936 PR fortran/44047 PR fortran/45384 * gfortran.h (struct gfc_association_list): New flag `dangling'. (gfc_build_block_ns): Declared here... * parse.h (gfc_build_block_ns): ...instead of here. * trans.h (gfc_process_block_locals): Expect additionally the gfc_association_list of BLOCK (if present). * match.c (select_type_set_tmp): Create sym->assoc for temporary. * resolve.c (resolve_variable): Only check for invalid *array* references on associate-names. (resolve_assoc_var): New method with code previously in resolve_symbol. (resolve_select_type): Use association to give the selector and temporaries their values instead of ordinary assignment. (resolve_fl_var_and_proc): Allow CLASS associate-names. (resolve_symbol): Use new `resolve_assoc_var' instead of inlining here. * trans-stmt.c (gfc_trans_block_construct): Pass association-list to `gfc_process_block_locals' to match new interface. * trans-decl.c (gfc_get_symbol_decl): Don't defer associate-names here automatically. (gfc_process_block_locals): Defer them rather here when linked to from the BLOCK's association list. 2010-08-26 Daniel Kraft PR fortran/38936 PR fortran/44047 PR fortran/45384 * gfortran.dg/associate_8.f03: New test. * gfortran.dg/select_type_13.f03: New test. * gfortran.dg/select_type_14.f03: New test. Added: trunk/gcc/testsuite/gfortran.dg/associate_8.f03 trunk/gcc/testsuite/gfortran.dg/select_type_13.f03 trunk/gcc/testsuite/gfortran.dg/select_type_14.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/match.c trunk/gcc/fortran/parse.h trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-stmt.c trunk/gcc/fortran/trans.h trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #12 from domob at gcc dot gnu dot org 2010-08-21 16:58 --- See also PR 45369 which has a rather complicated test-case for association to derived-types (as is currently not yet working). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #11 from domob at gcc dot gnu dot org 2010-08-21 16:57 --- *** Bug 45369 has been marked as a duplicate of this bug. *** -- domob at gcc dot gnu dot org changed: What|Removed |Added CC||clerman at fuse dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #10 from domob at gcc dot gnu dot org 2010-08-17 08:23 --- This implements association to variables and removes the problems that were still there with array expressions and bounds. What's still missing is: * Association to polymorphic entities * Association to strings (works partially, but has a lot of problems) * Association to derived types (should work in principle, but the parser does not like component references on the associate-names) * More checks for what is and is not a variable definition context and which associate names may appear in it -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #9 from domob at gcc dot gnu dot org 2010-08-17 08:20 --- Subject: Bug 38936 Author: domob Date: Tue Aug 17 08:20:03 2010 New Revision: 163295 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163295 Log: 2010-08-17 Daniel Kraft PR fortran/38936 * gfortran.h (struct gfc_association_list): New member `where'. (gfc_is_associate_pointer) New method. * match.c (gfc_match_associate): Remember locus for each associate name matched and do not try to set variable flag. * parse.c (parse_associate): Use remembered locus for symbols. * primary.c (match_variable): Instead of variable-flag check for associate names set it for all such names used. * symbol.c (gfc_is_associate_pointer): New method. * resolve.c (resolve_block_construct): Don't generate assignments to give associate-names their values. (resolve_fl_var_and_proc): Allow associate-names to be deferred-shape. (resolve_symbol): Set some more attributes for associate variables, set variable flag here and check it and don't try to build an explicitely shaped array-spec for array associate variables. * trans-expr.c (gfc_conv_variable): Dereference in case of association to scalar variable. * trans-types.c (gfc_is_nodesc_array): Handle array association symbols. (gfc_sym_type): Return pointer type for association to scalar vars. * trans-decl.c (gfc_get_symbol_decl): Defer association symbols. (trans_associate_var): New method. (gfc_trans_deferred_vars): Handle association symbols. 2010-08-17 Daniel Kraft PR fortran/38936 * gfortran.dg/associate_1.f03: Extended to test newly supported features like association to variables. * gfortran.dg/associate_3.f03: Removed check for illegal change of associate-name here... * gfortran.dg/associate_5.f03: ...and added it here. * gfortran.dg/associate_6.f03: No longer XFAIL'ed. * gfortran.dg/associate_7.f03: New test. Added: trunk/gcc/testsuite/gfortran.dg/associate_7.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/match.c trunk/gcc/fortran/parse.c trunk/gcc/fortran/primary.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/symbol.c trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans-types.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/associate_1.f03 trunk/gcc/testsuite/gfortran.dg/associate_3.f03 trunk/gcc/testsuite/gfortran.dg/associate_5.f03 trunk/gcc/testsuite/gfortran.dg/associate_6.f03 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #8 from domob at gcc dot gnu dot org 2010-08-16 08:59 --- Also one thing to note is that associate-names associated to expressions (which must not appear in variable definition contexts) are currently accepted as actual arguments to INTENT([IN]OUT) arguments. This should probably be checked and rejected. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #7 from domob at gcc dot gnu dot org 2010-08-15 20:25 --- This extended the support to array-expressions -- the original example works now. Next will be a rework to do the association in the trans phase, which is probably necessary to get full array support and association to variables working. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #6 from domob at gcc dot gnu dot org 2010-08-15 19:46 --- Subject: Bug 38936 Author: domob Date: Sun Aug 15 19:46:21 2010 New Revision: 163268 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163268 Log: 2010-08-15 Daniel Kraft PR fortran/38936 * gfortran.h (gfc_find_proc_namespace): New method. * expr.c (gfc_build_intrinsic_call): No need to build symtree messing around with namespace. * symbol.c (gfc_find_proc_namespace): New method. * trans-decl.c (gfc_build_qualified_array): Use it for correct value of nest. * primary.c (gfc_match_varspec): Handle associate-names as arrays. * parse.c (parse_associate): Removed assignment-generation here... * resolve.c (resolve_block_construct): ...and added it here. (resolve_variable): Handle names that are arrays but were not parsed as such because of association. (resolve_code): Fix BLOCK resolution. (resolve_symbol): Generate array-spec for associate-names. 2010-08-15 Daniel Kraft PR fortran/38936 * gfortran.dg/associate_1.f03: Enable test for array expressions. * gfortran.dg/associate_3.f03: Clarify comment. * gfortran.dg/associate_5.f03: New test. * gfortran.dg/associate_6.f03: New test. Added: trunk/gcc/testsuite/gfortran.dg/associate_5.f03 trunk/gcc/testsuite/gfortran.dg/associate_6.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/expr.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/parse.c trunk/gcc/fortran/primary.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/symbol.c trunk/gcc/fortran/trans-decl.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/associate_1.f03 trunk/gcc/testsuite/gfortran.dg/associate_3.f03 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #5 from domob at gcc dot gnu dot org 2010-06-10 16:50 --- This first commit implements association to scalar expressions as a first step. More to follow. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #4 from domob at gcc dot gnu dot org 2010-06-10 14:48 --- Subject: Bug 38936 Author: domob Date: Thu Jun 10 14:47:49 2010 New Revision: 160550 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160550 Log: 2010-06-10 Daniel Kraft PR fortran/38936 * gfortran.h (enum gfc_statement): Add ST_ASSOCIATE, ST_END_ASSOCIATE. (struct gfc_symbol): New field `assoc'. (struct gfc_association_list): New struct. (struct gfc_code): New struct `block' in union, move `ns' there and add association list. (gfc_free_association_list): New method. (gfc_has_vector_subscript): Made public; * match.h (gfc_match_associate): New method. * parse.h (enum gfc_compile_state): Add COMP_ASSOCIATE. * decl.c (gfc_match_end): Handle ST_END_ASSOCIATE. * interface.c (gfc_has_vector_subscript): Made public. (compare_actual_formal): Rename `has_vector_subscript' accordingly. * match.c (gfc_match_associate): New method. (gfc_match_select_type): Change reference to gfc_code's `ns' field. * primary.c (match_variable): Don't allow names associated to expr here. * parse.c (decode_statement): Try matching ASSOCIATE statement. (case_exec_markers, case_end): Add ASSOCIATE statement. (gfc_ascii_statement): Hande ST_ASSOCIATE and ST_END_ASSOCIATE. (parse_associate): New method. (parse_executable): Handle ST_ASSOCIATE. (parse_block_construct): Change reference to gfc_code's `ns' field. * resolve.c (resolve_select_type): Ditto. (resolve_code): Ditto. (resolve_block_construct): Ditto and add comment. (resolve_select_type): Set association list in generated BLOCK to NULL. (resolve_symbol): Resolve associate names. * st.c (gfc_free_statement): Change reference to gfc_code's `ns' field and free association list. (gfc_free_association_list): New method. * symbol.c (gfc_new_symbol): NULL new field `assoc'. * trans-stmt.c (gfc_trans_block_construct): Change reference to gfc_code's `ns' field. 2010-06-10 Daniel Kraft PR fortran/38936 * gfortran.dg/associate_1.f03: New test. * gfortran.dg/associate_2.f95: New test. * gfortran.dg/associate_3.f03: New test. * gfortran.dg/associate_4.f08: New test. Added: trunk/gcc/testsuite/gfortran.dg/associate_1.f03 trunk/gcc/testsuite/gfortran.dg/associate_2.f95 trunk/gcc/testsuite/gfortran.dg/associate_3.f03 trunk/gcc/testsuite/gfortran.dg/associate_4.f08 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/interface.c trunk/gcc/fortran/match.c trunk/gcc/fortran/match.h trunk/gcc/fortran/parse.c trunk/gcc/fortran/parse.h trunk/gcc/fortran/primary.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/st.c trunk/gcc/fortran/symbol.c trunk/gcc/fortran/trans-stmt.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #3 from domob at gcc dot gnu dot org 2010-05-08 13:24 --- Taking this finally. -- 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-01-25 10:19:44 |2010-05-08 13:24:00 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936
[Bug fortran/38936] F2003: ASSOCIATE construct / improved SELECT TYPE (a=>expr)
--- Comment #2 from burnus at gcc dot gnu dot org 2009-10-09 12:08 --- SELECT TYPE (name => expr) and ASSOCIATE (name1 => expr1, name2 => expr2) have similar syntax and issues. SELECT TYPE (name=>expr) is already implemented (via creating a new pointer variable), but it has some issues. The idea is to replace the expression - at least when it is definable - by the variable (be it in resolve.c or in trans*.c). Cf. also http://gcc.gnu.org/ml/fortran/2009-10/msg00075.html Maybe one should do something alike for TYPE IS() and (when implemented) CLASS IS(), cf. http://gcc.gnu.org/ml/fortran/2009-10/msg00075.html -- burnus at gcc dot gnu dot org changed: What|Removed |Added Summary|F2003: ASSOCIATE construct |F2003: ASSOCIATE construct / ||improved SELECT TYPE ||(a=>expr) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38936