public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26041]  New: FORTRAN compiler won't compile the valid code
@ 2006-01-31  1:46 hjl at lucon dot org
  2006-01-31  2:04 ` [Bug fortran/26041] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: hjl at lucon dot org @ 2006-01-31  1:46 UTC (permalink / raw)
  To: gcc-bugs

[hjl@gnu-16 cpu2006-465]$ cat foo.f90
module foo
   public    bar_
   interface bar_
      module procedure bar
   end interface
   public    xxx_
   interface xxx_
      module procedure xxx
   end interface
contains
   subroutine xxx(self,z)
      interface
         function self(z) result(res)
            real(kind=kind(1.0d0)), dimension(:) :: z
            real(kind=kind(1.0d0)) :: res
         end function
      end interface
      call bar_(self)
   end subroutine
   subroutine bar(self)
      interface
         function self(z) result(res)
            real(kind=kind(1.0d0)) :: res
         end function
      end interface
   end subroutine
end
[hjl@gnu-16 cpu2006-465]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/gfortran
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -S foo.f90
 In file foo.f90:18

      call bar_(self)
                    1
Error: Generic subroutine 'bar_' at (1) is not an intrinsic subroutine
make: *** [foo.s] Error 1
[hjl@gnu-16 cpu2006-465]$

Intel FORTRAN compiler has no problem. If I remove

            real(kind=kind(1.0d0)), dimension(:) :: z

gfortran can compile it.


-- 
           Summary: FORTRAN compiler won't compile the valid code
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
@ 2006-01-31  2:04 ` pinskia at gcc dot gnu dot org
  2006-01-31  4:58 ` hjl at lucon dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-31  2:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-31 02:04 -------
This does not look like valid code.
As the types of the dummy z are different.
The error message is bogus but that is a different bug. PR 20067.

Arrays have nothing to do with it by the way, you can reproduce the error with:
module foo
   public    bar_
   interface bar_
      module procedure bar
   end interface
   public    xxx_
   interface xxx_
      module procedure xxx
   end interface
contains
   subroutine xxx(self,z)
      interface
         function self(z) result(res)
            integer :: z
            real :: res
         end function
      end interface
      call bar_(self)
   end subroutine
   subroutine bar(self)
      interface
         function self(z) result(res)
            real :: z
            real :: res
         end function
      end interface
   end subroutine
end


And it is obvious from there that bar_ cannot be called from xxx.  (Intel's
fortran compiler accepts this too which I find weird as this is obvious broken
code).


-- 


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
  2006-01-31  2:04 ` [Bug fortran/26041] " pinskia at gcc dot gnu dot org
@ 2006-01-31  4:58 ` hjl at lucon dot org
  2006-01-31 23:34 ` hjl at lucon dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at lucon dot org @ 2006-01-31  4:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl at lucon dot org  2006-01-31 04:58 -------
How about this?

[hjl@gnu-16 cpu2006-465b]$ !cat
cat foo.f90
module foo
   public    bar_
   interface bar_
      module procedure bar
   end interface
   public    xxx_
   interface xxx_
      module procedure xxx
   end interface
contains
   subroutine bar(self, z)
      interface
         function self(z) result(res)
            real z
            real(kind=kind(1.0d0)) :: res
         end function
      end interface
   end subroutine
   subroutine xxx(self,z)
      interface
         function self(z) result(res)
            real z
            real(kind=kind(1.0d0)) :: res
         end function
      end interface
      call bar_(self, z)
   end subroutine
end
[hjl@gnu-16 cpu2006-465b]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/gfortran
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -S foo.f90
 In file foo.f90:26

      call bar_(self, z)
                       1
Error: Generic subroutine 'bar_' at (1) is not an intrinsic subroutine
make: *** [foo.s] Error 1
[hjl@gnu-16 cpu2006-465b]$

If I swap the order of xxx and bar, it compiles:

[hjl@gnu-16 cpu2006-465b]$ !cat
cat foo.f90
module foo
   public    bar_
   interface bar_
      module procedure bar
   end interface
   public    xxx_
   interface xxx_
      module procedure xxx
   end interface
contains
   subroutine xxx(self,z)
      interface
         function self(z) result(res)
            real z
            real(kind=kind(1.0d0)) :: res
         end function
      end interface
      call bar_(self, z)
   end subroutine
   subroutine bar(self, z)
      interface
         function self(z) result(res)
            real z
            real(kind=kind(1.0d0)) :: res
         end function
      end interface
   end subroutine
end
[hjl@gnu-16 cpu2006-465b]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/gfortran
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -S foo.f90
[hjl@gnu-16 cpu2006-465b]$


-- 


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
  2006-01-31  2:04 ` [Bug fortran/26041] " pinskia at gcc dot gnu dot org
  2006-01-31  4:58 ` hjl at lucon dot org
@ 2006-01-31 23:34 ` hjl at lucon dot org
  2006-02-01 11:29 ` eedelman at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at lucon dot org @ 2006-01-31 23:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl at lucon dot org  2006-01-31 23:34 -------
The problem is in gfc_resolve:

void
gfc_resolve (gfc_namespace * ns)
{
  ...
  gfc_traverse_ns (ns, resolve_symbol);
  ...
  for (n = ns->contained; n; n = n->sibling)
    gfc_resolve (ns)
  ...
  resolve_code (ns->code, ns);
  ...
}

Depending on the order of the code, resolve_code may be called before symbols
are resolved.


-- 


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (2 preceding siblings ...)
  2006-01-31 23:34 ` hjl at lucon dot org
@ 2006-02-01 11:29 ` eedelman at gcc dot gnu dot org
  2006-02-01 14:46 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: eedelman at gcc dot gnu dot org @ 2006-02-01 11:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from eedelman at gcc dot gnu dot org  2006-02-01 11:29 -------
(In reply to comment #2)
> How about this?

As far as I can see, this latter testcase is valid code.  Confirmed.

An additional comment:  

If I change the call to the generic subroutine bar_ in xxx to a call to the
specific subroutine bar, I get

In file hum.f90:26

      call bar(self, z)
              1
Error: Type/rank mismatch in argument 'self' at (1)

which is also wrong.


-- 

eedelman at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-01 11:29:18
               date|                            |


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (3 preceding siblings ...)
  2006-02-01 11:29 ` eedelman at gcc dot gnu dot org
@ 2006-02-01 14:46 ` pinskia at gcc dot gnu dot org
  2006-02-01 16:49 ` hjl at lucon dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-01 14:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-02-01 14:46 -------
Patch posted:
http://gcc.gnu.org/ml/gcc-patches/2006-01/msg02261.html


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2006-
                   |                            |01/msg02261.html
           Keywords|                            |patch


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (4 preceding siblings ...)
  2006-02-01 14:46 ` pinskia at gcc dot gnu dot org
@ 2006-02-01 16:49 ` hjl at lucon dot org
  2006-02-02  1:18 ` hjl at lucon dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at lucon dot org @ 2006-02-01 16:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hjl at lucon dot org  2006-02-01 16:49 -------
*** Bug 26064 has been marked as a duplicate of this bug. ***


-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sven dot buijssen at math
                   |                            |dot uni-dortmund dot de


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (5 preceding siblings ...)
  2006-02-01 16:49 ` hjl at lucon dot org
@ 2006-02-02  1:18 ` hjl at lucon dot org
  2006-02-05 19:52 ` hjl at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at lucon dot org @ 2006-02-02  1:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hjl at lucon dot org  2006-02-02 01:18 -------
An updated patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00102.html


-- 


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (6 preceding siblings ...)
  2006-02-02  1:18 ` hjl at lucon dot org
@ 2006-02-05 19:52 ` hjl at gcc dot gnu dot org
  2006-02-05 19:53 ` hjl at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at gcc dot gnu dot org @ 2006-02-05 19:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl at gcc dot gnu dot org  2006-02-05 19:52 -------
Subject: Bug 26041

Author: hjl
Date: Sun Feb  5 19:52:35 2006
New Revision: 110618

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110618
Log:
2006-02-05  H.J. Lu  <hongjiu.lu@intel.com>

        PR fortran/26041
        PR fortran/26064
        * gfortran.dg/sibling_dummy_procedure_1.f90: New file.
        * gfortran.dg/sibling_dummy_procedure_2.f90: Likewise.
        * gfortran.dg/sibling_dummy_procedure_3.f90: Likewise.

Added:
    trunk/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f90
    trunk/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f90
    trunk/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/26041] FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (7 preceding siblings ...)
  2006-02-05 19:52 ` hjl at gcc dot gnu dot org
@ 2006-02-05 19:53 ` hjl at gcc dot gnu dot org
  2006-03-06 23:25 ` [Bug fortran/26041] [4.1]: " pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at gcc dot gnu dot org @ 2006-02-05 19:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hjl at gcc dot gnu dot org  2006-02-05 19:53 -------
Subject: Bug 26041

Author: hjl
Date: Sun Feb  5 19:53:00 2006
New Revision: 110619

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110619
Log:
2006-02-05  H.J. Lu  <hongjiu.lu@intel.com>

        PR fortran/26041
        PR fortran/26064
        * resolve.c (resolve_types): New function.
        (resolve_codes): Likewise.
        (gfc_resolve): Use them.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c


-- 


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


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

* [Bug fortran/26041] [4.1]: FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (8 preceding siblings ...)
  2006-02-05 19:53 ` hjl at gcc dot gnu dot org
@ 2006-03-06 23:25 ` pault at gcc dot gnu dot org
  2006-03-07 22:29 ` hjl at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-03-06 23:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pault at gcc dot gnu dot org  2006-03-06 23:25 -------
HJ

Will you port this to 4.1 or should it be closed? My preference would be the
former....

Paul


-- 


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


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

* [Bug fortran/26041] [4.1]: FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (9 preceding siblings ...)
  2006-03-06 23:25 ` [Bug fortran/26041] [4.1]: " pault at gcc dot gnu dot org
@ 2006-03-07 22:29 ` hjl at gcc dot gnu dot org
  2006-03-07 22:31 ` hjl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at gcc dot gnu dot org @ 2006-03-07 22:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from hjl at gcc dot gnu dot org  2006-03-07 22:29 -------
Subject: Bug 26041

Author: hjl
Date: Tue Mar  7 22:29:32 2006
New Revision: 111821

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111821
Log:
2006-03-07  H.J. Lu  <hongjiu.lu@intel.com>

        PR fortran/26041
        PR fortran/26064
        Backport from mainline
        * resolve.c (resolve_types): New function.
        (resolve_codes): Likewise.
        (gfc_resolve): Use them.

Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/resolve.c


-- 


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


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

* [Bug fortran/26041] [4.1]: FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (10 preceding siblings ...)
  2006-03-07 22:29 ` hjl at gcc dot gnu dot org
@ 2006-03-07 22:31 ` hjl at gcc dot gnu dot org
  2006-03-07 22:32 ` hjl at lucon dot org
  2006-03-07 22:35 ` pinskia at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at gcc dot gnu dot org @ 2006-03-07 22:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from hjl at gcc dot gnu dot org  2006-03-07 22:31 -------
Subject: Bug 26041

Author: hjl
Date: Tue Mar  7 22:30:58 2006
New Revision: 111822

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111822
Log:
2006-03-07  H.J. Lu  <hongjiu.lu@intel.com>

        PR fortran/26041
        PR fortran/26064
        Backport from mainline
        * gfortran.dg/sibling_dummy_procedure_1.f90: New file.
        * gfortran.dg/sibling_dummy_procedure_2.f90: Likewise.
        * gfortran.dg/sibling_dummy_procedure_3.f90: Likewise.

Added:
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_1.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_2.f90
   
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/sibling_dummy_procedure_3.f90
Modified:
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/26041] [4.1]: FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (11 preceding siblings ...)
  2006-03-07 22:31 ` hjl at gcc dot gnu dot org
@ 2006-03-07 22:32 ` hjl at lucon dot org
  2006-03-07 22:35 ` pinskia at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: hjl at lucon dot org @ 2006-03-07 22:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from hjl at lucon dot org  2006-03-07 22:32 -------
Fixed.


-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/26041] [4.1]: FORTRAN compiler won't compile the valid code
  2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
                   ` (12 preceding siblings ...)
  2006-03-07 22:32 ` hjl at lucon dot org
@ 2006-03-07 22:35 ` pinskia at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-07 22:35 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.1


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


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

end of thread, other threads:[~2006-03-07 22:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-31  1:46 [Bug fortran/26041] New: FORTRAN compiler won't compile the valid code hjl at lucon dot org
2006-01-31  2:04 ` [Bug fortran/26041] " pinskia at gcc dot gnu dot org
2006-01-31  4:58 ` hjl at lucon dot org
2006-01-31 23:34 ` hjl at lucon dot org
2006-02-01 11:29 ` eedelman at gcc dot gnu dot org
2006-02-01 14:46 ` pinskia at gcc dot gnu dot org
2006-02-01 16:49 ` hjl at lucon dot org
2006-02-02  1:18 ` hjl at lucon dot org
2006-02-05 19:52 ` hjl at gcc dot gnu dot org
2006-02-05 19:53 ` hjl at gcc dot gnu dot org
2006-03-06 23:25 ` [Bug fortran/26041] [4.1]: " pault at gcc dot gnu dot org
2006-03-07 22:29 ` hjl at gcc dot gnu dot org
2006-03-07 22:31 ` hjl at gcc dot gnu dot org
2006-03-07 22:32 ` hjl at lucon dot org
2006-03-07 22:35 ` pinskia 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).