This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: fortran/26041: FORTRAN compiler won't compile the valid code
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Wed, 1 Feb 2006 19:33:30 -0800
- Subject: Re: PATCH: fortran/26041: FORTRAN compiler won't compile the valid code
- References: <20060131235212.GA16716@lucon.org> <20060202011740.GA929@lucon.org> <831d4c3126946ecc01aac91e04755f1e@physics.uc.edu>
On Wed, Feb 01, 2006 at 08:49:28PM -0500, Andrew Pinski wrote:
>
> On Feb 1, 2006, at 8:17 PM, H. J. Lu wrote:
> >
> >It turns out that resolve_code has to be called in the right order. I
> >am testing this on Linux/x86-64 now.
> >
> >
> >H.J.
> >----
> >2006-01-31 H.J. Lu <hongjiu.lu@intel.com>
> >
> > PR fortran/26041
> > PR fortran/26064
> > * resolve.c (gfc_resolve_type): New function.
> > (gfc_resolve_code): Likewise.
> > (gfc_resolve): Use them.
>
> Can you make sure that all three testcases get added?
>
Here is the patch for 3 testcases.
H.J.
---
2006-02-02 H.J. Lu <hongjiu.lu@intel.com>
PR fortran/26041
PR fortran/26064
* gfortran.dg/pr26041-1.f90: New file.
* gfortran.dg/pr26041-2.f90: Likewise.
* gfortran.dg/pr26064.f90: Likewise.
--- gcc/testsuite/gfortran.dg/pr26041-1.f90.type 2006-02-01 19:09:12.000000000 -0800
+++ gcc/testsuite/gfortran.dg/pr26041-1.f90 2006-02-01 19:03:05.000000000 -0800
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! This checks the fix for PR 26041.
+!
+! Contributed by H.J. Lu <hongjiu.lu@intel.com>
+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
--- gcc/testsuite/gfortran.dg/pr26041-2.f90.type 2006-02-01 19:09:07.000000000 -0800
+++ gcc/testsuite/gfortran.dg/pr26041-2.f90 2006-02-01 18:55:10.000000000 -0800
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! This checks the fix for PR 26041.
+!
+! Contributed by H.J. Lu <hongjiu.lu@intel.com>
+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
--- gcc/testsuite/gfortran.dg/pr26064.f90.type 2006-02-01 19:09:19.000000000 -0800
+++ gcc/testsuite/gfortran.dg/pr26064.f90 2006-02-01 19:07:53.000000000 -0800
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! This checks the fix for PR 26064
+!
+! Contributed by Sven Buijssen <sven.buijssen@math.uni-dortmund.de>
+module ice
+ implicit none
+ contains
+
+ subroutine foo()
+ contains
+
+ subroutine bar(baz)
+ integer, optional :: baz
+ if (present(baz)) then
+ endif
+ end subroutine bar
+ end subroutine foo
+end module