[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
-- pinskia at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.1.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #8 from pault at gcc dot gnu dot org 2006-01-13 20:57 --- As agreed with Tobi, the commit of the patch to 4.1 for this PR will happen tomorrow morning. As it happens, it is regtesting as I write. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #9 from pault at gcc dot gnu dot org 2006-01-14 06:31 --- Subject: Bug 25029 Author: pault Date: Sat Jan 14 06:31:08 2006 New Revision: 109698 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=109698 Log: 2006-01-14 Paul Thomas [EMAIL PROTECTED] PR fortran/22146 * trans-array.c (gfc_reverse_ss): Remove static attribute. (gfc_walk_elemental_function_args): Replace gfc_expr * argument for the function call with the corresponding gfc_actual_arglist*. Change code accordingly. (gfc_walk_function_expr): Call to gfc_walk_elemental_function_args now requires the actual argument list instead of the expression for the function call. * trans-array.h: Modify the prototype for gfc_walk_elemental_function_args and provide a prototype for gfc_reverse_ss. * trans-stmt.h (gfc_trans_call): Add the scalarization code for the case where an elemental subroutine has array valued actual arguments. PR fortran/25029 PR fortran/21256 PR fortran/20868 PR fortran/20870 * resolve.c (check_assumed_size_reference): New function to check for upper bound in assumed size array references. (resolve_assumed_size_actual): New function to do a very restricted scan of actual argument expressions of those procedures for which incomplete assumed size array references are not allowed. (resolve_function, resolve_call): Switch off assumed size checking of actual arguments, except for elemental procedures and intrinsic inquiry functions, in some circumstances. (resolve_variable): Call check_assumed_size_reference. 2006-01-14 Paul Thomas [EMAIL PROTECTED] PR fortran/22146 * gfortran.dg/elemental_subroutine_1.f90: New test. * gfortran.dg/elemental_subroutine_2.f90: New test. PR fortran/25029 PR fortran/21256 * gfortran.dg/assumed_size_refs_1.f90: New test. PR fortran/20868 PR fortran/20870 * gfortran.dg/assumed_size_refs_2.f90: New test. * gfortran.dg/initialization_1.f90: Change warning message. * gfortran.dg/pr15140.f90: Add bound to assumed size reference. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/assumed_size_refs_2.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_subroutine_2.f90 Modified: branches/gcc-4_1-branch/MAINTAINERS branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/fortran/trans-array.c branches/gcc-4_1-branch/gcc/fortran/trans-array.h branches/gcc-4_1-branch/gcc/fortran/trans-intrinsic.c branches/gcc-4_1-branch/gcc/fortran/trans-stmt.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/initialization_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/pr15140.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #10 from pault at gcc dot gnu dot org 2006-01-14 07:24 --- Fixed on mainline and 4.1. Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #7 from pault at gcc dot gnu dot org 2006-01-07 14:14 --- Subject: Bug 25029 Author: pault Date: Sat Jan 7 14:14:08 2006 New Revision: 109449 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=109449 Log: 2006-01-07 Paul Thomas [EMAIL PROTECTED] PR fortran/22146 * trans-array.c (gfc_reverse_ss): Remove static attribute. (gfc_walk_elemental_function_args): Replace gfc_expr * argument for the function call with the corresponding gfc_actual_arglist*. Change code accordingly. (gfc_walk_function_expr): Call to gfc_walk_elemental_function_args now requires the actual argument list instead of the expression for the function call. * trans-array.h: Modify the prototype for gfc_walk_elemental_function_args and provide a prototype for gfc_reverse_ss. * trans-stmt.h (gfc_trans_call): Add the scalarization code for the case where an elemental subroutine has array valued actual arguments. PR fortran/25029 PR fortran/21256 PR fortran/20868 PR fortran/20870 * resolve.c (check_assumed_size_reference): New function to check for upper bound in assumed size array references. (resolve_assumed_size_actual): New function to do a very restricted scan of actual argument expressions of those procedures for which incomplete assumed size array references are not allowed. (resolve_function, resolve_call): Switch off assumed size checking of actual arguments, except for elemental procedures and intrinsic inquiry functions, in some circumstances. (resolve_variable): Call check_assumed_size_reference. 2006-01-07 Paul Thomas [EMAIL PROTECTED] PR fortran/22146 * gfortran.dg/elemental_subroutine_1.f90: New test. * gfortran.dg/elemental_subroutine_2.f90: New test. PR fortran/25029 PR fortran/21256 * gfortran.dg/assumed_size_refs_1.f90: New test. PR fortran/20868 PR fortran/20870 * gfortran.dg/assumed_size_refs_2.f90: New test. * gfortran.dg/initialization_1.f90: Change warning message. Added: trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90 (with props) trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_2.f90 (with props) trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_1.f90 trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_2.f90 Modified: trunk/MAINTAINERS trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/fortran/trans-array.c trunk/gcc/fortran/trans-array.h trunk/gcc/fortran/trans-intrinsic.c trunk/gcc/fortran/trans-stmt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/initialization_1.f90 Added: trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90 URL: http://gcc.gnu.org/viewcvs/trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90?root=gccview=autorev=109449 == --- trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90 (added) +++ trunk/gcc/testsuite/gfortran.dg/assumed_size_refs_1.f90 Sat Jan 7 14:14:08 2006 @@ -1,0 +1,64 @@ +!==assumed_size_refs_1.f90== +! { dg-do compile } +! Test the fix for PR25029, PR21256 in which references to +! assumed size arrays without an upper bound to the last +! dimension were generating no error. The first version of +! the patch failed in DHSEQR, as pointed out by Toon Moene +! in http://gcc.gnu.org/ml/fortran/2005-12/msg00466.html +! +! Contributed by Paul Thomas [EMAIL PROTECTED] +! +program assumed_size_test_1 + implicit none + real a(2, 4) + + a = 1.0 + call foo (a) + +contains + subroutine foo(m) +real, target :: m(1:2, *) +real x(2,2,2) +real, external :: bar +real, pointer :: p(:,:), q(:,:) +allocate (q(2,2)) + +! PR25029 +p = m ! { dg-error upper bound in the last dimension } +q = m ! { dg-error upper bound in the last dimension } + +! PR21256( and PR25060) +m = 1 ! { dg-error upper bound in the last dimension } + +m(1,1) = 2.0 +x = bar (m) +x = fcn (m)! { dg-error upper bound in the last dimension } +m(:, 1:2) = fcn (q) +call sub (m, x)! { dg-error upper bound in the last dimension } +call sub (m(1:2, 1:2), x) +print *, p + +call DHSEQR(x) + + end subroutine foo + + elemental function fcn (a) result (b) +real, intent(in) :: a +real :: b +b = 2.0 * a + end function fcn + + elemental subroutine sub (a, b) +real, intent(inout) :: a, b +b = 2.0 * a + end subroutine sub + + SUBROUTINE DHSEQR( WORK ) +REAL WORK( * ) +EXTERNAL DLARFX +INTRINSIC MIN +WORK( 1 ) = 1.0 +CALL DLARFX( MIN( 1, 8 ), WORK ) + END SUBROUTINE DHSEQR + +end program
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #5 from tobi at gcc dot gnu dot org 2005-12-30 14:11 --- Paul, I was wondering why you added this PR to the ChangeLogs, as it's still present, or has the bug reappeared? -- tobi at gcc dot gnu dot org changed: What|Removed |Added CC||tobi at gcc dot gnu dot org, ||pault at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #6 from pault at gcc dot gnu dot org 2005-12-30 15:19 --- An easy question for a change! No, I had committed the patch but had to remove it because it broke things in ways that I could not handle, whilst we had house guests. 2005-12-24 Paul Thomas [EMAIL PROTECTED] PR fortran/25029 PR fortran/21256 * resolve.c (check_assumed_size_reference, resolve_assumed_size_actual): Remove because of regressions caused by patch. (resolve_function, resolve_call, resolve_variable): Remove assumed size checks because of regressionscaused by patch. The upgraded version is regtesting, as I write. I am going to add Toon's testcase and to make absolutely sure, this time, that all the intrinsics behave correctly. I should be submitting tomorrow morning. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #4 from pault at gcc dot gnu dot org 2005-12-24 12:05 --- Subject: Bug 25029 Author: pault Date: Sat Dec 24 12:05:36 2005 New Revision: 109039 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=109039 Log: 2005-12-24 Paul Thomas [EMAIL PROTECTED] PR fortran/25029 PR fortran/21256 * resolve.c (check_assumed_size_reference, resolve_assumed_size_actual): Remove because of regressions caused by patch. (resolve_function, resolve_call, resolve_variable): Remove assumed size checks because of regressionscaused by patch. PR fortran/25029 PR fortran/21256 * gfortran.dg/initialization_1.f90: Remove tests of intrinsic functions with incorrect assumed size references. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/initialization_1.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #3 from pault at gcc dot gnu dot org 2005-12-23 06:41 --- Subject: Bug 25029 Author: pault Date: Fri Dec 23 06:41:52 2005 New Revision: 109009 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=109009 Log: 2005-12-23 Paul Thomas [EMAIL PROTECTED] PR fortran/25029 PR fortran/21256 *resolve.c(resolve_function): Remove assumed size checking for SIZE and UBOUND and rely on their built-in checking. 2005-12-23 Paul Thomas [EMAIL PROTECTED] PR fortran/25029 PR fortran/21256 *gfortran.dg/initialization_1.f90: Add test of SIZE. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/initialization_1.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #2 from pault at gcc dot gnu dot org 2005-12-22 07:05 --- Subject: Bug 25029 Author: pault Date: Thu Dec 22 07:05:22 2005 New Revision: 108943 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=108943 Log: 2005-12-22 Paul Thomas [EMAIL PROTECTED] PR fortran/20889 *resolve.c(resolve_structure_cons): Do not attempt to convert the type of mismatched pointer type components, except when the constructor component is BT_UNKNOWN; emit error instead. PR fortran/25029 PR fortran/21256 *resolve.c(check_assumed_size_reference): New function to check for upper bound in assumed size array references. (resolve_assumed_size_actual): New function to do a very restricted scan of actual argument expressions of those procedures for which incomplete assumed size array references are not allowed. (resolve_function, resolve_call): Switch off assumed size checking of actual arguments, except for elemental procedures and array valued intrinsics; excepting LBOUND. (resolve_variable): Call check_assumed_size_reference. PR fortran/19362 PR fortran/20244 PR fortran/20864 PR fortran/25391 *interface.c(gfc_compare_types): Broken into two. (gfc_compare_derived_types): Second half of gfc_compare_types with corrections for a missing check that module name is non-NULL and a check for private components. *symbol.c(gfc_free_dt_list): New function. (gfc_free_namespace): Call gfc_free_dt_list. *resolve.c(resolve_symbol): Build the list of derived types in the symbols namespace. *gfortran.h: Define the structure type gfc_dt_list. Add a new field, derived_types to gfc_namespace. Provide a prototye for the new function gfc_compare_derived_types. *trans_types.c(gfc_get_derived_type): Test for the derived type being available in the host namespace. In this case, the host backend declaration is used for the structure and its components. If an unbuilt, equal structure that is not use associated is found in the host namespace, build it there and then. On exit,traverse the namespace of the derived type to see if there are equal but unbuilt. If so, copy the structure and its component declarations. (copy_dt_decls_ifequal): New functions to copy declarations to other equal structure types. PR fortran/20862 * io.c (gfc_match_format): Make the appearance of a format statement in a module specification block an error. PR fortran/23152 * match.c (gfc_match_namelist): Set assumed shape arrays in namelists as std=GFC_STD_GNU and assumed size arrays as an unconditional error. PR fortran/25069 * match.c (gfc_match_namelist): Set the respecification of a USE associated namelist group as std=GFC_STD_GNU. Permit the concatenation on no error. PR fortran/25053 PR fortran/25063 PR fortran/25064 PR fortran/25066 PR fortran/25067 PR fortran/25068 PR fortran/25307 * io.c (resolve_tag): Change std on IOSTAT != default integer to GFC_STD_GNU and change message accordingly. Add same error for SIZE. (match_dt_element, gfortran.h): Add field err_where to gfc_dt and set it when tags are being matched. (gfc_resolve_dt): Remove tests that can be done before resolution and add some of the new ones here. (check_io_constraints): New function that checks for most of the data transfer constraints. Some of these were previously done in match_io, from where this function is called, and some were done in gfc_resolve_dt. (match_io): Remove most of the tests of constraints and add the call to check_io_constraints. 2005-12-22 Paul Thomas [EMAIL PROTECTED] PR fortran/20889 *gfortran.dg/pointer_component_type_1.f90: New test. PR fortran/25029 PR fortran/21256 *gfortran.dg/assumed_size_refs.f90: New test for the conditions that should give an error with assumed size array refernces and checks those that should not. *gfortran.dg/gfortran.dg/pr15140.f90: Give the assumed size array reference an upper bound so that it does not generate an error. PR fortran/19362 PR fortran/20244 PR fortran/20864 PR fortran/25391 *gfortran.dg/used_dummy_types_1.f90: New test. *gfortran.dg/used_dummy_types_2.f90: New test. *gfortran.dg/used_dummy_types_3.f90: New test. *gfortran.dg/used_dummy_types_4.f90: New test. *gfortran.dg/used_dummy_types_5.f90: New test. PR fortran/23152 *gfortran.dg/namelist_use.f90: Add trap for warning on NAMELIST group
[Bug fortran/25029] Assumed size array can be associated with array pointer without upper bound of last dimension
--- Comment #1 from eedelman at gcc dot gnu dot org 2005-11-25 15:37 --- Confirmed. A few comments: Since the subroutine foo isn't called, we can't expect any output. If, however, we add a the line call foo(a) after the line a(1:4) = 1 we still don't get any output (or, to be precise, we get an empty line). In any case, the pointer assignment shouldn't be allowed, since no size information is available for the dummy m (p = m(1:4) would be OK). A similar problem occours is if we have code like program ptrtest implicit none integer a(4) a(1:4) = 1 call foo(a) contains subroutine foo(m) integer, target :: m(*) integer :: p p = sum(m) print *, p end subroutine end program Again, gfortran should print an errormessage, but doesn't (running the executable prints 0). -- eedelman at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords||diagnostic Last reconfirmed|-00-00 00:00:00 |2005-11-25 15:37:41 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25029