summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/assignment_2.f90
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-26 22:33:35 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-26 22:33:35 +0000
commit187a3ad695a391a74077b36d6e9558c7fcba4d87 (patch)
tree491eee3f4bb92adcf2c5327e4178a0792616b4ce /gcc/testsuite/gfortran.dg/assignment_2.f90
parentaaa37ad6ecff7152c8e1e5e53eeb1b98c802fb24 (diff)
downloadgcc-187a3ad695a391a74077b36d6e9558c7fcba4d87.tar.gz
2008-02-26 Tobias Burnus <burnus@net-b.de>
PR fortran/35033 * interface.c (check_operator_interface): Show better line for * error messages; fix constrains for user-defined assignment operators. (gfc_extend_assign): Fix constrains for user-defined assignment operators. 2008-02-26 Tobias Burnus <burnus@net-b.de> PR fortran/35033 * gfortran.dg/assignment_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132689 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/assignment_2.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/assignment_2.f9049
1 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/assignment_2.f90 b/gcc/testsuite/gfortran.dg/assignment_2.f90
new file mode 100644
index 00000000000..3549fbea983
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assignment_2.f90
@@ -0,0 +1,49 @@
+! { dg-do compile }
+!
+! PR fortran/35033
+!
+! The checks for assignments were too strict.
+!
+MODULE m1
+ INTERFACE ASSIGNMENT(=)
+ SUBROUTINE s(a,b)
+ REAL,INTENT(OUT) :: a(1,*)
+ REAL,INTENT(IN) :: b(:)
+ END SUBROUTINE
+ END Interface
+contains
+ subroutine test1()
+ REAL,POINTER :: p(:,:),q(:)
+ CALL s(p,q)
+ p = q
+ end subroutine test1
+end module m1
+
+MODULE m2
+ INTERFACE ASSIGNMENT(=)
+ SUBROUTINE s(a,b)
+ REAL,INTENT(OUT),VOLATILE :: a(1,*)
+ REAL,INTENT(IN) :: b(:)
+ END SUBROUTINE
+ END Interface
+contains
+ subroutine test1()
+ REAL,POINTER :: p(:,:),q(:)
+ CALL s(p,q) ! { dg-error "requires an assumed-shape or pointer-array dummy" }
+!TODO: The following is rightly rejected but the error message is misleading.
+! The actual reason is the mismatch between pointer array and VOLATILE
+ p = q ! { dg-error "Incompatible ranks" }
+ end subroutine test1
+end module m2
+
+MODULE m3
+ INTERFACE ASSIGNMENT(=)
+ module procedure s ! { dg-error "must not redefine an INTRINSIC type" }
+ END Interface
+contains
+ SUBROUTINE s(a,b)
+ REAL,INTENT(OUT),VOLATILE :: a(1,*)
+ REAL,INTENT(IN) :: b(:,:)
+ END SUBROUTINE
+end module m3
+