Summary: | TR 29113: Implement parts needed for MPI 3 | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | CC: | w6ws |
Priority: | P3 | ||
Version: | 4.7.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2011-12-31 00:00:00 | |
Bug Depends on: | |||
Bug Blocks: | 32630, 41897 | ||
Attachments: | Patch for TYPE(*) |
Description
Tobias Burnus
2011-04-29 12:45:45 UTC
Author: burnus Date: Fri May 6 18:12:25 2011 New Revision: 173500 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173500 Log: 2011-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/48858 PR fortran/48820 * lang.opt (std=f2008tr): New. * libgfortran.h (GFC_STD_F2008_TR): New macro constant. * decl.c (verify_c_interop_param): Allow OPTIONAL in BIND(C) procedures for -std=f2008tr/gnu/legacy. 2011-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/48858 PR fortran/48820 * gfortran.dg/bind_c_usage_22.f90: New. * gfortran.dg/bind_c_usage_23.f90: New. * gfortran.dg/bind_c_usage_24.f90: New. * gfortran.dg/bind_c_usage_24_c.c: New. Added: trunk/gcc/testsuite/gfortran.dg/bind_c_usage_22.f90 trunk/gcc/testsuite/gfortran.dg/bind_c_usage_23.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/invoke.texi trunk/gcc/fortran/lang.opt trunk/gcc/fortran/libgfortran.h trunk/gcc/fortran/options.c trunk/gcc/testsuite/ChangeLog Author: burnus Date: Fri May 6 18:33:31 2011 New Revision: 173503 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173503 Log: Really commit: 2011-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/48858 PR fortran/48820 * gfortran.dg/bind_c_usage_24.f90: New. * gfortran.dg/bind_c_usage_24_c.c: New. Added: trunk/gcc/testsuite/gfortran.dg/bind_c_usage_24.f90 trunk/gcc/testsuite/gfortran.dg/bind_c_usage_24_c.c Author: burnus Date: Fri May 27 18:51:31 2011 New Revision: 174348 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174348 Log: 2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.h (gfc_isym_id): Add GFC_ISYM_RANK. * intrinsic.c (add_functions): Add rank intrinsic. (gfc_check_intrinsic_standard): Handle GFC_STD_F2008_TR. * intrinsic.h (gfc_simplify_rank, gfc_check_rank): Add * prototypes. * simplify.c (gfc_simplify_rank): New function. * intrinsic.texi (RANK): Add description for rank intrinsic. * check.c (gfc_check_rank): New function. 2011-05-27 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/rank_3.f90: New. * gfortran.dg/rank_4.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/rank_3.f90 trunk/gcc/testsuite/gfortran.dg/rank_4.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/check.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/intrinsic.c trunk/gcc/fortran/intrinsic.h trunk/gcc/fortran/intrinsic.texi trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog Added myself to the cc list. (Interested in the assumed rank and assumed type portions.) For assumed type, see early draft patch at http://gcc.gnu.org/ml/fortran/2012-02/msg00111.html (and, in the thread, for a MPIv3-related discussion) Latest TS29113 draft: http://j3-fortran.org/doc/meeting/197/12-119r1.pdf Tobias, If you are interested, I tried the patch you posted on the email list to a freshly checked out trunk. After building the compiler, I tried the following small test case: module mpi_interface implicit none interface mpi_send subroutine MPI_Send (buf, count, datatype, dest, tag, comm, ierr) type(*), intent(in) :: buf(:) integer, intent(in) :: count integer, intent(in) :: datatype integer, intent(in) :: dest integer, intent(in) :: tag integer, intent(in) :: comm integer, intent(out):: ierr end subroutine end interface end module The compiler gave the following error: mpi_interface.F90:16.10: end module 1 Internal Error at (1): gfc_code2string(): Bad code If I change the 'buf(:)' to 'buf(*)' I get the same error. Hope this helps, Walter Created attachment 26799 [details]
Patch for TYPE(*)
Patch for TYPE(*). The patch should be feature complete (i.e. everything should work, including diagnostic), but is only very lightly tested.
It also contains the run-time part of the RANK intrinsic - which is unreachable code as - for all currently supported expressions - the rank is known at compile time. [RANK() exists since GCC 4.7.]
(RANK will become more useful with "DIMENSION(..)". Note that the run-time version currently fails for scalars - even if they have an array descriptor as coarray scalars do.)
(In reply to comment #7) > Created attachment 26799 [details] > Patch for TYPE(*) Just a warning to testers: I have the impression that for scalar allocatables and pointers, the wrong pointer address is passed (the one of the pointer instead of the pointer target.) Also, shape/size but not lbound/ubound seem to be mishandled and I had some issue with optional and null pointers ("null()", c_null_ptr, nonallocated/nonassociated [(non)polymorphic {scalar/array}] allocatable/pointer.) [And to be really useful, one needs to implement the relaxed constraints of F2008 and TS29113 regarding BIND(C) and C_LOC. gfortran has currently a rather strict - some times too strict (even for F2003) checking.] (In reply to comment #8) > > Patch for TYPE(*) > > Just a warning to testers: [...] Actually, the argument passing issue was a test-case bug. However, SHAPE and SIZE (w/o dim=) where indeed mishandled. That's now fixed. Patch, submitted for GCC 4.8: http://gcc.gnu.org/ml/fortran/2012-03/msg00004.html Author: burnus Date: Sat Mar 3 08:40:24 2012 New Revision: 184852 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184852 Log: 2012-03-03 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * decl.c (gfc_match_decl_type_spec): Support type(*). (gfc_verify_c_interop): Allow type(*). * dump-parse-tree.c (show_typespec): Handle type(*). * expr.c (gfc_copy_expr): Ditto. * interface.c (compare_type_rank, compare_parameter, compare_actual_formal, gfc_procedure_use): Ditto. * libgfortran.h (bt): Add BT_ASSUMED. * misc.c (gfc_basic_typename, gfc_typename): Handle type(*). * module.c (bt_types): Ditto. * resolve.c (assumed_type_expr_allowed): New static variable. (resolve_actual_arglist, resolve_variable, resolve_symbol): Handle type(*). * trans-expr.c (gfc_conv_procedure_call): Ditto. * trans-types.c (gfc_typenode_for_spec, gfc_get_dtype): Ditto. 2012-03-03 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_type_1.f90: New. * gfortran.dg/assumed_type_2.f90: New. * gfortran.dg/assumed_type_3.f90: New. * gfortran.dg/assumed_type_4.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/assumed_type_1.f90 trunk/gcc/testsuite/gfortran.dg/assumed_type_2.f90 trunk/gcc/testsuite/gfortran.dg/assumed_type_3.f90 trunk/gcc/testsuite/gfortran.dg/assumed_type_4.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/dump-parse-tree.c trunk/gcc/fortran/expr.c trunk/gcc/fortran/interface.c trunk/gcc/fortran/libgfortran.h trunk/gcc/fortran/misc.c trunk/gcc/fortran/module.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans-types.c trunk/gcc/testsuite/ChangeLog Author: burnus Date: Sat Mar 3 14:11:24 2012 New Revision: 184856 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184856 Log: 2012-03-03 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_type_1.f90: Correct dg-error. * gfortran.dg/assumed_type_3.f90: Correct dg-error. * gfortran.dg/assumed_type_4.f90: Correct dg-error. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/assumed_type_1.f90 trunk/gcc/testsuite/gfortran.dg/assumed_type_3.f90 trunk/gcc/testsuite/gfortran.dg/assumed_type_4.f90 Author: burnus Date: Sat Mar 3 18:55:57 2012 New Revision: 184863 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184863 Log: 2012-03-03 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * resolve.c (resolve_actual_arglist): Properly reset assumed_type_expr_allowed. 2012-03-03 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_type_3.f90: Undo previous commit. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/assumed_type_3.f90 DONE (of TS2008): Asynchronous (since 4.6); -std=f2008ts flag and OPTIONAL + Bind(C) (since 4.7); and type(*) (in 4.8). Question to J3 regarding TYPE(*) with INTENT(OUT): http://j3-fortran.org/pipermail/j3/2012-March/005104.html Still to do for MPIv3: 1. Assumed rank(..) handling [without Bind(C)], including updated intrinsics (is_contiguous, rank, shape, size, lbound, ubound). intent(out) - on the callee side. Handle also scalars. (I have a very early draft patch.) (This will operate on gfortran's current array descriptor.) 2. Update/relax checking for various C interop functions such as c_loc and c_f_pointer. Cf. also PR48858 (!) and PR47023 but also PR40963, PR38829, PR39288, PR38813. Currently, some valid F2003 is also rejected; F2008 and TS 29113 relaxed constraints are unimplemented. Meta bug: PR32630 3. Implement the new array descriptor (cf. PR 37577, PR 48820) (a) Fortran implementation (b) Add ISO_Fortran_binding.h (c) Allow it with Bind(C), including "intent(out)" - on the caller side and "character(len=*)" That completes the MPI_SUBARRAYS_SUPPORTED==.true. and character(len=*) support - and thus all of TS29113 and all what MPI v3 maximally requires. Cf. http://svn.mpi-forum.org/trac2/mpi-forum-web/ticket/229#comment:21 Re-reading the standard, I think the non-BIND(C) version of TYPE(*) is currently mishandled. That should be only visible for "TYPE(*)" dummies which are INTENT(OUT) and where the actual argument is a derived type with default initialization or has allocatable components (possibly even with finalization subroutines). See http://gcc.gnu.org/ml/fortran/2012-03/msg00037.html and http://j3-fortran.org/pipermail/j3/2012-March/005113.html (In reply to comment #14) > Re-reading the standard, I think the non-BIND(C) version of TYPE(*) is > currently mishandled. That should be only visible for "TYPE(*)" dummies which > are INTENT(OUT) and where the actual argument is a derived type with default > initialization or has allocatable components (possibly even with finalization > subroutines). > > See http://gcc.gnu.org/ml/fortran/2012-03/msg00037.html and > http://j3-fortran.org/pipermail/j3/2012-March/005113.html Some J3 members seem to agree that that's not a good idea. To add a link to a thread in yet another mailing list: http://j3-fortran.org/pipermail/interop-tr/2012-March/001058.html Thus, the current type(*) implementation seems to be okay. Author: burnus Date: Fri Jul 20 05:56:37 2012 New Revision: 189700 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189700 Log: 2012-07-20 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * array.c (match_array_element_spec, gfc_match_array_spec, spec_size, gfc_array_dimen_size): Add support for assumed-rank arrays. * check.c (dim_rank_check): Ditto. * class.c (gfc_add_component_ref): Ditto. (gfc_build_class_symbol): Regard assumed-rank arrays as having GFC_MAX_DIMENSIONS. And build extra class container for a scalar pointer class. * decl.c (merge_array_spec): Add assert. * dump-parse-tree.c (show_array_spec): Add support for assumed-rank arrays. * expr.c (gfc_is_simply_contiguous): Ditto. * gfortran.h (array_type): Ditto. (gfc_array_spec, gfc_expr): Add comment to "rank" field. * interface.c (compare_type_rank, argument_rank_mismatch, compare_parameter, gfc_procedure_use): Ditto. (compare_actual_formal): Fix NULL() to optional-dummy handling for polymorphic dummies. * module.c (mio_typespec): Add support for assumed-rank arrays. * resolve.c (resolve_formal_arglist, resolve_actual_arglist, resolve_elemental_actual, resolve_global_procedure, expression_shape, resolve_variable, update_ppc_arglist, check_typebound_baseobject, gfc_resolve_expr, resolve_fl_var_and_proc, gfc_resolve_finalizers, resolve_typebound_procedure, resolve_symbol): Ditto. (assumed_type_expr_allowed): Remove static variable. (actual_arg, first_actual_arg): New static variables. * simplify.c (simplify_bound, gfc_simplify_range): Add support for assumed-rank arrays. * trans-array.c (gfc_conv_array_parameter): Ditto. (gfc_get_descriptor_dimension): New function, which returns the descriptor. (gfc_conv_descriptor_dimension): Use it. (gfc_conv_descriptor_stride_get, gfc_conv_array_parameter): Handle GFC_ARRAY_ASSUMED_RANK_CONT and AS_ASSUMED_RANK. * trans-array.h (gfc_get_descriptor_dimension): New prototype. * trans-decl. (gfc_build_dummy_array_decl, gfc_trans_deferred_vars, add_argument_checking): Add support for assumed-rank arrays. * trans-expr.c (gfc_conv_expr_present, gfc_conv_variable, gfc_conv_procedure_call): Ditto. (get_scalar_to_descriptor_type, class_array_data_assign, conv_scalar_to_descriptor): New static functions. (gfc_conv_derived_to_class, gfc_conv_class_to_class): Use them. * trans-intrinsic.c (get_rank_from_desc): New function. (gfc_conv_intrinsic_rank, gfc_conv_associated): Use it. * trans-types.c (gfc_array_descriptor_base_caf, gfc_array_descriptor_base): Make space for scalar array. (gfc_is_nodesc_array, gfc_is_nodesc_array, gfc_build_array_type, gfc_get_array_descriptor_base): Add support for assumed-rank arrays. * trans.h (gfc_array_kind): Add GFC_ARRAY_ASSUMED_RANK and GFC_ARRAY_ASSUMED_RANK_CONT. 2012-07-20 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_type_3.f90: Update dg-error. * gfortran.dg/assumed_rank_1.f90: New. * gfortran.dg/assumed_rank_1_c.c: New. * gfortran.dg/assumed_rank_2.f90: New. * gfortran.dg/assumed_rank_4.f90: New. * gfortran.dg/assumed_rank_5.f90: New. * gfortran.dg/assumed_rank_6.f90: New. * gfortran.dg/assumed_rank_7.f90: New. * gfortran.dg/assumed_rank_8.f90: New. * gfortran.dg/assumed_rank_8_c.c: New. * gfortran.dg/assumed_rank_9.f90: New. * gfortran.dg/assumed_rank_10.f90: New. * gfortran.dg/assumed_rank_12.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/assumed_rank_1.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_10.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_12.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_1_c.c trunk/gcc/testsuite/gfortran.dg/assumed_rank_2.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_4.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_5.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_6.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_7.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_8.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_8_c.c trunk/gcc/testsuite/gfortran.dg/assumed_rank_9.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/array.c trunk/gcc/fortran/check.c trunk/gcc/fortran/class.c trunk/gcc/fortran/decl.c trunk/gcc/fortran/dump-parse-tree.c trunk/gcc/fortran/expr.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/interface.c trunk/gcc/fortran/module.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/simplify.c trunk/gcc/fortran/trans-array.c trunk/gcc/fortran/trans-array.h trunk/gcc/fortran/trans-decl.c trunk/gcc/fortran/trans-expr.c trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/fortran/trans-types.c trunk/gcc/fortran/trans.h trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/assumed_type_3.f90 Status: Now also assumed-ranks are supported. TODO: 1. Remaining issues of assumed-rank, e.g. shape/ubound/lbound, class-to-type handling, contiguous attribute. 2. Update/relax checking for various C interop functions such as c_loc and c_f_pointer. Cf. also PR48858 (!) and PR47023 but also PR40963, PR38829, PR39288, PR38813. Currently, some valid F2003 is also rejected; F2008 and TS 29113 relaxed constraints are unimplemented. Meta bug: PR32630 4. Implement the new array descriptor (cf. PR 37577, PR 48820) Author: burnus Date: Sat Jul 21 11:02:47 2012 New Revision: 189743 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189743 Log: 2012-07-21 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * trans-intrinsic.c (gfc_conv_intrinsic_bound): Support lbound/ubound with dim= for assumed-rank arrays. * array.c (gfc_set_array_spec): Reject coarrays with assumed shape. * decl.c (merge_array_spec): Ditto. Return gfc_try. (match_attr_spec, match_attr_spec): Update call. 2012-07-21 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_rank_3.f90: New. * gfortran.dg/assumed_rank_11.f90: New. * gfortran.dg/assumed_rank_1.f90: Update dg-error. * gfortran.dg/assumed_rank_2.f90: Update dg-error. * gfortran.dg/assumed_rank_7.f90: Update dg-error. Added: trunk/gcc/testsuite/gfortran.dg/assumed_rank_11.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_3.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/array.c trunk/gcc/fortran/decl.c trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/assumed_rank_1.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_2.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_6.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_7.f90 (In reply to comment #17) > TODO: > 1. Remaining issues of assumed-rank, e.g. shape/ubound/lbound, > class-to-type handling, contiguous attribute. And INTENT(OUT) handling, cf. http://gcc.gnu.org/ml/fortran/2012-08/msg00000.html Patch for shape/ubound/lbound: http://gcc.gnu.org/ml/fortran/2012-07/msg00132.html > 2. Update/relax checking for various C interop functions such as c_loc and > c_f_pointer. Cf. also PR48858 (!) and PR47023 but also PR40963, PR38829, > PR39288, PR38813. Currently, some valid F2003 is also rejected; F2008 and > TS 29113 relaxed constraints are unimplemented. Meta bug: PR32630 See also http://gcc.gnu.org/ml/fortran/2012-07/msg00115.html for some TODO items. [c_funloc, c_f_procpointer has been fixed with Rev. 190003.] > 4. Implement the new array descriptor (cf. PR 37577, PR 48820) Author: mikael Date: Thu Aug 2 19:48:50 2012 New Revision: 190098 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190098 Log: fortran/ PR fortran/48820 * trans-array.c (gfc_conv_ss_startstride): Set the intrinsic result's lower and upper bounds according to the rank. (set_loop_bounds): Set the loop upper bound in the intrinsic case. testsuite/ PR fortran/48820 * gfortran.dg/assumed_rank_bounds_1.f90: New test. * gfortran.dg/assumed_rank_bounds_2.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/assumed_rank_bounds_1.f90 trunk/gcc/testsuite/gfortran.dg/assumed_rank_bounds_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-array.c trunk/gcc/testsuite/ChangeLog No activity for over three years, broken links, ... . IMO this PR should be closed as FIXED and new PR(s) should be opened for remaining issue(s) not covered by existing PRs. > No activity for over three years, broken links, ... . IMO this PR should
> be closed as FIXED and new PR(s) should be opened for remaining issue(s)
> not covered by existing PRs.
No feedback, closing as FIXED.
|