public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30870]  New: incorrect error message for valid code
@ 2007-02-20  7:49 jv244 at cam dot ac dot uk
  2007-02-20 16:55 ` [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument burnus at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jv244 at cam dot ac dot uk @ 2007-02-20  7:49 UTC (permalink / raw)
  To: gcc-bugs

With recent trunk, gfortran incorrectly generates an error for the following
standard code:
MODULE TEST
 INTERFACE xx
   MODULE PROCEDURE xx
 END INTERFACE
 public :: xx
CONTAINS
 SUBROUTINE xx(i)
  INTEGER :: I
  I=7
 END SUBROUTINE
END
MODULE TOO
CONTAINS
 SUBROUTINE SUB(xx,I)
  INTERFACE
    SUBROUTINE XX(I)
        INTEGER :: I
    END SUBROUTINE
  END INTERFACE
  CALL XX(I)
 END SUBROUTINE
END MODULE TOO
PROGRAM TT
 USE TEST
 USE TOO
 INTEGER :: I
 CALL SUB(xx,I)
 IF (I.NE.7) CALL ABORT()
END PROGRAM


-- 
           Summary: incorrect error message for valid code
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument
  2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
@ 2007-02-20 16:55 ` burnus at gcc dot gnu dot org
  2007-02-21 10:47 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-02-20 16:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-02-20 16:55 -------
The program compiles with ifort, g95 and nagf95.

gfortran rejects it with:
 CALL SUB(xx,I)
         1
Error: GENERIC non-INTRINSIC procedure 'xx' is not allowed as an actual
argument at (1)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
           Keywords|                            |rejects-valid
            Summary|incorrect error message for |GENERIC non-INTRINSIC
                   |valid code                  |procedure rejected as actual
                   |                            |argument


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument
  2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
  2007-02-20 16:55 ` [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument burnus at gcc dot gnu dot org
@ 2007-02-21 10:47 ` pault at gcc dot gnu dot org
  2007-03-12  6:55 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-02-21 10:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2007-02-21 10:47 -------
This fixes it:

Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c       (revision 122101)
--- gcc/fortran/resolve.c       (working copy)
*************** resolve_actual_arglist (gfc_actual_argli
*** 924,932 ****

          if (sym->attr.generic)
            {
!             gfc_error ("GENERIC non-INTRINSIC procedure '%s' is not "
!                        "allowed as an actual argument at %L", sym->name,
!                        &e->where);
            }

          /* If the symbol is the function that names the current (or
--- 924,943 ----

          if (sym->attr.generic)
            {
!             gfc_interface *p;
!             for (p = sym->generic; p; p = p->next)
!               if (strcmp (sym->name, p->sym->name) == 0)
!                 {
!                   e->symtree = gfc_find_symtree
!                                 (p->sym->ns->sym_root, sym->name);
!                   sym = p->sym;
!                   break;
!                 }
!
!             if (p == NULL || e->symtree == NULL)
!               gfc_error ("GENERIC non-INTRINSIC procedure '%s' is not "
!                          "allowed as an actual argument at %L", sym->name,
!                          &e->where);
            }

          /* If the symbol is the function that names the current (or

It needs commenting to the effect that a generic that is also a specific is OK.

I'd be more than happy if somebody would regtest/submit/commit this one - I
cannot for some weeks.

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument
  2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
  2007-02-20 16:55 ` [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument burnus at gcc dot gnu dot org
  2007-02-21 10:47 ` pault at gcc dot gnu dot org
@ 2007-03-12  6:55 ` pault at gcc dot gnu dot org
  2007-03-12 15:25 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-12  6:55 UTC (permalink / raw)
  To: gcc-bugs



-- 

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|0000-00-00 00:00:00         |2007-03-12 06:55:35
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument
  2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
                   ` (2 preceding siblings ...)
  2007-03-12  6:55 ` pault at gcc dot gnu dot org
@ 2007-03-12 15:25 ` pault at gcc dot gnu dot org
  2007-03-15  6:45 ` pault at gcc dot gnu dot org
  2007-03-27  9:04 ` [Bug fortran/30870] [4.1, 4.2 only] " pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-12 15:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-03-12 15:25 -------
I just submitted a patch for this PR.

Paul


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument
  2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
                   ` (3 preceding siblings ...)
  2007-03-12 15:25 ` pault at gcc dot gnu dot org
@ 2007-03-15  6:45 ` pault at gcc dot gnu dot org
  2007-03-27  9:04 ` [Bug fortran/30870] [4.1, 4.2 only] " pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-15  6:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-03-15 06:44 -------
Subject: Bug 30870

Author: pault
Date: Thu Mar 15 06:44:25 2007
New Revision: 122944

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122944
Log:
2007-03-15  Tobias Burnus  <burnus@gcc.gnu.org>
            Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30922
        * decl.c (gfc_match_import): If the parent of the current name-
        space is null, try looking for an imported symbol in the parent
        of the proc_name interface.
        * resolve.c (resolve_fl_variable): Do not check for blocking of
        host association by a same symbol, if the symbol is in an
        interface body.

2007-03-15  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30879
        * decl.c (match_data_constant): Before going on to try to match
        a name, try to match a structure component.


        PR fortran/30870
        * resolve.c (resolve_actual_arglist): Do not reject a generic
        actual argument if it has a same name specific interface.

        PR fortran/31163
        * trans-array.c (parse_interface): Do not nullify allocatable
        components if the symbol has the saved attribute.


2007-03-15  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/30922
        * gfortran.dg/import5.f90.f90: New test.


        PR fortran/30879
        * gfortran.dg/data_components_1.f90: New test.


        PR fortran/30870
        * gfortran.dg/generic_13.f90: New test.

        PR fortran/31163
        * gfortran.dg/alloc_comp_basics_5.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_basics_5.f90
    trunk/gcc/testsuite/gfortran.dg/data_components_1.f90
    trunk/gcc/testsuite/gfortran.dg/generic_13.f90
    trunk/gcc/testsuite/gfortran.dg/import5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/30870] [4.1, 4.2 only] GENERIC non-INTRINSIC procedure rejected as actual argument
  2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
                   ` (4 preceding siblings ...)
  2007-03-15  6:45 ` pault at gcc dot gnu dot org
@ 2007-03-27  9:04 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-27  9:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2007-03-27 10:03 -------
This is not a regression wrt 4.1 so closing.

Paul


-- 

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=30870


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-03-27  9:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-20  7:49 [Bug fortran/30870] New: incorrect error message for valid code jv244 at cam dot ac dot uk
2007-02-20 16:55 ` [Bug fortran/30870] GENERIC non-INTRINSIC procedure rejected as actual argument burnus at gcc dot gnu dot org
2007-02-21 10:47 ` pault at gcc dot gnu dot org
2007-03-12  6:55 ` pault at gcc dot gnu dot org
2007-03-12 15:25 ` pault at gcc dot gnu dot org
2007-03-15  6:45 ` pault at gcc dot gnu dot org
2007-03-27  9:04 ` [Bug fortran/30870] [4.1, 4.2 only] " pault 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).