public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32157]  New: Can a subroutine have the same name as an intrinsic function?
@ 2007-05-30 15:07 michael dot a dot richmond at nasa dot gov
  2007-05-30 16:59 ` [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file burnus at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: michael dot a dot richmond at nasa dot gov @ 2007-05-30 15:07 UTC (permalink / raw)
  To: gcc-bugs

When I compile the program listed below I get the message "Error: Global name
'len' at (1) is already being used as a FUNCTION at (2)"

For what it's worth, Compaq, Lahey, and g95 do not consider it an error.

PROGRAM VAL
i = len(" ")
END
SUBROUTINE len(i)
END


-- 
           Summary: Can a subroutine have the same name as an intrinsic
                    function?
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot a dot richmond at nasa dot gov


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
@ 2007-05-30 16:59 ` burnus at gcc dot gnu dot org
  2007-06-22 13:03 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-30 16:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-05-30 16:58 -------
> When I compile the program listed below I get the message "Error: Global name
> 'len' at (1) is already being used as a FUNCTION at (2)"
(add NAG f95 to the list of compilers)

This is a bug in gfortran; an extended example is shown below.

subroutine len(c)
  implicit none
  character :: c
  c = "X"
end subroutine len

subroutine test()
  implicit none
  character :: str
  external len
  call len(str)
  if(str /= "X") call abort()
end subroutine test

PROGRAM VAL
 implicit none
 external test
 intrinsic len
 call test()
 if(len(" ") /= 1) call abort()
END


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |4.3.0 4.2.0 4.1.3
   Last reconfirmed|0000-00-00 00:00:00         |2007-05-30 16:58:58
               date|                            |
            Summary|Can a subroutine have the   |intrinsic function name
                   |same name as an intrinsic   |conflicts with subroutine if
                   |function?                   |present in the same file
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
  2007-05-30 16:59 ` [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file burnus at gcc dot gnu dot org
@ 2007-06-22 13:03 ` pault at gcc dot gnu dot org
  2007-07-08 15:18 ` dfranke at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-06-22 13:03 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]



------- Comment #2 from pault at gcc dot gnu dot org  2007-06-22 13:03 -------
This fixes it:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (révision 125706)
+++ gcc/fortran/resolve.c       (copie de travail)
@@ -1568,6 +1568,8 @@ resolve_function (gfc_expr *expr)
   /* If the procedure is not internal, a statement function or a module
      procedure,it must be external and should be checked for usage.  */
   if (sym && !sym->attr.dummy && !sym->attr.contained
+      && !(sym->attr.intrinsic
+            || gfc_intrinsic_name (sym->name, sym->attr.subroutine))
       && sym->attr.proc != PROC_ST_FUNCTION
       && !sym->attr.use_assoc
       && sym->name  )

We paybe need a helper function, gfc_is_external - I'll check if there are
other clients.

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|NEW                         |ASSIGNED
   Last reconfirmed|2007-05-30 16:58:58         |2007-06-22 13:03:02
               date|                            |


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
  2007-05-30 16:59 ` [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file burnus at gcc dot gnu dot org
  2007-06-22 13:03 ` pault at gcc dot gnu dot org
@ 2007-07-08 15:18 ` dfranke at gcc dot gnu dot org
  2007-07-09  5:05 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-08 15:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2007-07-08 15:18 -------
Paul, your patch in comment #2 also seems to fix PR31609. 
Any plans to get it into trunk? :)


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
                   ` (2 preceding siblings ...)
  2007-07-08 15:18 ` dfranke at gcc dot gnu dot org
@ 2007-07-09  5:05 ` patchapp at dberlin dot org
  2007-07-09 14:25 ` dfranke at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2007-07-09  5:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from patchapp at dberlin dot org  2007-07-09 05:05 -------
Subject: Bug number PR32157

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/2007-07/msg00744.html


-- 


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
                   ` (3 preceding siblings ...)
  2007-07-09  5:05 ` patchapp at dberlin dot org
@ 2007-07-09 14:25 ` dfranke at gcc dot gnu dot org
  2007-07-10  5:11 ` pault at gcc dot gnu dot org
  2007-07-10  5:15 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-07-09 14:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2007-07-09 14:25 -------
*** Bug 32699 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
                   ` (4 preceding siblings ...)
  2007-07-09 14:25 ` dfranke at gcc dot gnu dot org
@ 2007-07-10  5:11 ` pault at gcc dot gnu dot org
  2007-07-10  5:15 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-10  5:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2007-07-10 05:11 -------
Subject: Bug 32157

Author: pault
Date: Tue Jul 10 05:11:00 2007
New Revision: 126509

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126509
Log:
2007-07-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32157
        * resolve.c (is_external_proc): New function.  Adds test that
        the symbol is not an intrinsic procedure.
        * (resolve_function, resolve_call): Replace logical statements
        with call to is_external_proc.

        PR fortran/32689
        * simplify.c (gfc_simplify_transfer): If mold has rank, the
        result is an array.

        PR fortran/32634
        * module.c (write_generic): Write the local name of the
        interface. 


2007-07-10  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32157
        * gfortran.dg/overload_2.f90: New test.

        PR fortran/32689
        * gfortran.dg/transfer_simplify_5.f90

        PR fortran/32634
        * gfortran.dg/interface_15.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/interface_16.f90
    trunk/gcc/testsuite/gfortran.dg/overload_2.f90
    trunk/gcc/testsuite/gfortran.dg/transfer_simplify_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file
  2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
                   ` (5 preceding siblings ...)
  2007-07-10  5:11 ` pault at gcc dot gnu dot org
@ 2007-07-10  5:15 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-07-10  5:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2007-07-10 05:15 -------
Fixed on trunk

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


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

end of thread, other threads:[~2007-07-10  5:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-30 15:07 [Bug fortran/32157] New: Can a subroutine have the same name as an intrinsic function? michael dot a dot richmond at nasa dot gov
2007-05-30 16:59 ` [Bug fortran/32157] intrinsic function name conflicts with subroutine if present in the same file burnus at gcc dot gnu dot org
2007-06-22 13:03 ` pault at gcc dot gnu dot org
2007-07-08 15:18 ` dfranke at gcc dot gnu dot org
2007-07-09  5:05 ` patchapp at dberlin dot org
2007-07-09 14:25 ` dfranke at gcc dot gnu dot org
2007-07-10  5:11 ` pault at gcc dot gnu dot org
2007-07-10  5:15 ` 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).