summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/equiv_constraint_8.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/equiv_constraint_8.f9016
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90 b/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90
new file mode 100644
index 000000000..1cb28b031
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/equiv_constraint_8.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-O0" }
+! PR20899 - Common block variables cannot be equivalenced in a pure procedure.
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+common /z/ i
+contains
+pure integer function test(j)
+ integer, intent(in) :: j
+ common /z/ i
+ integer :: k
+ equivalence(i,k) ! { dg-error "EQUIVALENCE object in the pure" }
+ k=1 ! { dg-error "variable definition context" }
+ test=i*j
+end function test
+end
+