[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #1 from enok at lysator dot liu dot se 2006-11-14 23:14 --- Created an attachment (id=12621) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12621&action=view) Small testcase that triggers the compiler bug gfortran4 -c tst.f90 In file tst.f90:22 CALL A(MAXVAL(X),Y) 1 Error: Actual argument at (1) must be definable to match dummy INTENT = OUT/INOUT -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837
[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #2 from kargl at gcc dot gnu dot org 2006-11-15 00:18 --- The trivial workaround is to assign MAXVAL(X) to an integer. SUBROUTINE T(X) INTEGER, INTENT(IN) :: X(:) INTEGER Y, Z z = maxval(x) CALL A(z,Y) END SUBROUTINE T I need to look at the standard with regards to conformance issues. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837
[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #3 from enok at lysator dot liu dot se 2006-11-15 08:06 --- (In reply to comment #2) > The trivial workaround is to assign MAXVAL(X) to an integer. Ok, but my real code is more complex. And I think there must be something wrong. If I put an "INTENT(IN)" variable as X it works. If I put an integer constant it fails: SUBROUTINE T2(X) INTEGER, INTENT(IN) :: X INTEGER Y CALL A(X,Y) ! Works! END SUBROUTINE T2 SUBROUTINE T3() INTEGER Y CALL A(10,Y) ! Fails! END SUBROUTINE T3 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837
[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #4 from pault at gcc dot gnu dot org 2006-11-16 08:01 --- This is due to a trivial error in: Index: /svn/trunk/gcc/fortran/interface.c === *** /svn/trunk/gcc/fortran/interface.c (revision 118704) --- /svn/trunk/gcc/fortran/interface.c (working copy) *** compare_actual_formal (gfc_actual_arglis *** 1379,1386 && (f->sym->attr.intent == INTENT_OUT || f->sym->attr.intent == INTENT_INOUT)) { ! gfc_error ("Actual argument at %L must be definable to " !"match dummy INTENT = OUT/INOUT", &a->expr->where); return 0; } --- 1383,1391 && (f->sym->attr.intent == INTENT_OUT || f->sym->attr.intent == INTENT_INOUT)) { ! if (where) ! gfc_error ("Actual argument at %L must be definable to " ! "match dummy INTENT = OUT/INOUT", &a->expr->where); return 0; } I will submit the patch and a testcase just as soon as I have a moment this afternoon. Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2006-11-16 08:01:03 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837
[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #5 from patchapp at dberlin dot org 2006-11-16 17:10 --- Subject: Bug number PR29837 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01186.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837
[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #6 from pault at gcc dot gnu dot org 2006-11-25 14:38 --- Subject: Bug 29837 Author: pault Date: Sat Nov 25 14:37:56 2006 New Revision: 119198 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119198 Log: 2006-11-25 Paul Thomas <[EMAIL PROTECTED]> PR fortran/20880 * parse.c (parse_interface): Error if procedure name is that of encompassing scope. * resolve.c (resolve_fl_procedure): Error if procedure is ambiguous. PR fortran/29837 * interface.c (compare_actual_formal): Add missing condition that 'where' be present for error that asserts that actual arguments be definable. 2006-11-25 Paul Thomas <[EMAIL PROTECTED]> PR fortran/20880 * gfortran.dg/interface_3.f90: New test. PR fortran/29837 * gfortran.dg/generic_8.f90: New test. Added: branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/generic_8.f90 branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/interface_3.f90 Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/interface.c branches/gcc-4_2-branch/gcc/fortran/parse.c branches/gcc-4_2-branch/gcc/fortran/resolve.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837
[Bug fortran/29837] INTERFACE overloading INTENT problem - valid code is rejected
--- Comment #7 from pault at gcc dot gnu dot org 2006-11-25 14:39 --- Fixed on trunk and 4.2. Will backport to 4.1 in coming week. Paul PS please not error in ChangeLog for trunk - will fix Monday. -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29837