aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-03-24 19:11:24 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-03-24 19:11:24 +0000
commitc1203a704d375608c84ec0f1f4af250025374e85 (patch)
treec592d85b7b3c57a66640b4f761c2ec48e47be498 /gcc/testsuite/gfortran.dg
parent50c91950d46fd5715ffd198227c50c7bce35f915 (diff)
downloadgcc-c1203a704d375608c84ec0f1f4af250025374e85.zip
gcc-c1203a704d375608c84ec0f1f4af250025374e85.tar.gz
gcc-c1203a704d375608c84ec0f1f4af250025374e85.tar.bz2
re PR fortran/34813 (ICE on incorrect nested type constructor (fold-const.c (fold_convert):2629))
2008-03-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/34813 * resolve.c (resolve_structure_cons): It is an error to assign NULL to anything other than a pointer or allocatable component. PR fortran/33295 * resolve.c (resolve_symbol): If the symbol is a derived type, resolve the derived type. If the symbol is a derived type function, ensure that the derived type is visible in the same namespace as the function. 2008-03-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/34813 * gfortran.dg/null_3.f90 : New test PR fortran/33295 * gfortran.dg/module_function_type_1.f90 : New test From-SVN: r133488
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/module_function_type_1.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/null_3.f9018
2 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/module_function_type_1.f90 b/gcc/testsuite/gfortran.dg/module_function_type_1.f90
new file mode 100644
index 0000000..b0a4048
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/module_function_type_1.f90
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! This checks the fix for PR33295 in which the A_type in initA was
+! not promoted to module level and so not recognised as being the
+! same as that emanating directly from module a.
+!
+! Contributed by Janus Weil <jaydub66@gmail.com>
+!
+module A
+ type A_type
+ real comp
+ end type
+end module A
+
+module B
+contains
+ function initA()
+ use A
+ implicit none
+ type(A_type):: initA
+ initA%comp=1.0
+ end function
+end module B
+
+program C
+ use B
+ use A
+ implicit none
+ type(A_type):: A_var
+ A_var = initA()
+end program C
+
+! { dg-final { cleanup-modules "A B" } }
+
diff --git a/gcc/testsuite/gfortran.dg/null_3.f90 b/gcc/testsuite/gfortran.dg/null_3.f90
new file mode 100644
index 0000000..141af1f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/null_3.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! This checks the fix for PR34813 in which the error at line 17
+! was not detected.
+!
+! Contributed by Daniel Franke <dfranke@gcc.gnu.org>
+!
+SUBROUTINE kd_tree_init_default()
+ TYPE :: kd_tree_node
+ INTEGER :: dummy
+ END TYPE
+
+ TYPE :: kd_tree
+ TYPE(kd_tree_node) :: root
+ END TYPE
+
+ TYPE(kd_tree) :: tree
+ tree = kd_tree(null()) ! { dg-error "neither a POINTER nor ALLOCATABLE" }
+END SUBROUTINE