aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2006-12-08 10:45:44 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2006-12-08 10:45:44 +0100
commitc3240b8d526ba878266751ac05b41f52b2c13840 (patch)
tree330a035e936df629acc237e160f4249d88aa366a /gcc
parentfaf8957192ac3ddff0f34990c0b339ec1fb23560 (diff)
downloadgcc-c3240b8d526ba878266751ac05b41f52b2c13840.zip
gcc-c3240b8d526ba878266751ac05b41f52b2c13840.tar.gz
gcc-c3240b8d526ba878266751ac05b41f52b2c13840.tar.bz2
re PR fortran/27546 (IMPORT is broken)
fortran/ 2006-12-08 Tobias Burnus <burnus@net-b.de> PR fortran/27546 * trans-decl.f90 (gfc_create_module_variable): Allow imported symbols in interface bodys in modules. testsuite/ 2006-12-08 Tobias Burnus <burnus@net-b.de> PR fortran/27546 * gfortran.dg/import4.f90: New test for IMPORT in modules. From-SVN: r119651
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-decl.c7
-rw-r--r--gcc/testsuite/ChangeLog15
-rw-r--r--gcc/testsuite/gfortran.dg/import4.f9099
4 files changed, 115 insertions, 12 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 95ce73f..be404ad 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/27546
+ * trans-decl.f90 (gfc_create_module_variable): Allow imported symbols
+ in interface bodys in modules.
+
2006-12-06 Tobias Burnus <burnus@net-b.de>
PR fortran/29711
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 270083f..67e654c 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -2760,13 +2760,6 @@ gfc_create_module_variable (gfc_symbol * sym)
if (sym->attr.entry)
return;
- /* Only output symbols from this module. */
- if (sym->ns != module_namespace)
- {
- /* I don't think this should ever happen. */
- internal_error ("module symbol %s in wrong namespace", sym->name);
- }
-
/* Only output variables and array valued parameters. */
if (sym->attr.flavor != FL_VARIABLE
&& (sym->attr.flavor != FL_PARAMETER || sym->attr.dimension == 0))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d1e707c..fbeef25 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/27546
+ * gfortran.dg/import4.f90: New test for IMPORT in modules.
+
2006-12-07 Mark Mitchell <mark@codesourcery.com>
PR c++/29732
@@ -12,10 +17,10 @@
2006-12-07 Lee Millward <lee.millward@codesourcery.com>
- PR c++/29980
- * g++.dg/ext/attrib27.C: New test.
- * g++.dg/parse/struct-as-enum1.C: Adjust error markers.
- * g++.dg/parse/typedef5.C: Likewise.
+ PR c++/29980
+ * g++.dg/ext/attrib27.C: New test.
+ * g++.dg/parse/struct-as-enum1.C: Adjust error markers.
+ * g++.dg/parse/typedef5.C: Likewise.
2006-12-07 Mike Stump <mrs@apple.com>
@@ -250,7 +255,7 @@
2006-11-29 Andrew Pinski <andrew_pinski@playstation.sony.com>
- PR target/29945
+ PR target/29945
* gcc.c-torture/compile/pr29945.c: New testcase.
2006-11-30 Joseph Myers <joseph@codesourcery.com>
diff --git a/gcc/testsuite/gfortran.dg/import4.f90 b/gcc/testsuite/gfortran.dg/import4.f90
new file mode 100644
index 0000000..761c984
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/import4.f90
@@ -0,0 +1,99 @@
+! { dg-do run }
+! Test for import in modules
+! PR fortran/29601
+
+subroutine bar(r)
+ implicit none
+ integer(8) :: r
+ if(r /= 42) call abort()
+ r = 13
+end subroutine bar
+
+subroutine foo(a)
+ implicit none
+ type myT
+ sequence
+ character(len=3) :: c
+ end type myT
+ type(myT) :: a
+ if(a%c /= "xyz") call abort()
+ a%c = "abc"
+end subroutine
+
+subroutine new(a,b)
+ implicit none
+ type gType
+ sequence
+ integer(8) :: c
+ end type gType
+ real(8) :: a
+ type(gType) :: b
+ if(a /= 99.0 .or. b%c /= 11) call abort()
+ a = -123.0
+ b%c = -44
+end subroutine new
+
+module general
+ implicit none
+ integer,parameter :: ikind = 8
+ type gType
+ sequence
+ integer(ikind) :: c
+ end type gType
+end module general
+
+module modtest
+ use general
+ implicit none
+ type myT
+ sequence
+ character(len=3) :: c
+ end type myT
+ integer, parameter :: dp = 8
+ interface
+ subroutine bar(x)
+ import :: dp
+ integer(dp) :: x
+ end subroutine bar
+ subroutine foo(c)
+ import :: myT
+ type(myT) :: c
+ end subroutine foo
+ subroutine new(x,y)
+ import :: ikind,gType
+ real(ikind) :: x
+ type(gType) :: y
+ end subroutine new
+ end interface
+ contains
+ subroutine test
+ integer(dp) :: y
+ y = 42
+ call bar(y)
+ if(y /= 13) call abort()
+ end subroutine test
+ subroutine test2()
+ type(myT) :: z
+ z%c = "xyz"
+ call foo(z)
+ if(z%c /= "abc") call abort()
+ end subroutine test2
+end module modtest
+
+program all
+ use modtest
+ implicit none
+ call test()
+ call test2()
+ call test3()
+contains
+ subroutine test3()
+ real(ikind) :: r
+ type(gType) :: t
+ r = 99.0
+ t%c = 11
+ call new(r,t)
+ if(r /= -123.0 .or. t%c /= -44) call abort()
+ end subroutine test3
+end program all
+! { dg-final { cleanup-modules "modtest general" } }