summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-18 18:55:01 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-18 18:55:01 +0000
commit14efb9b7b52e816aa93ea4a451b5c10eb7634a8b (patch)
tree604f003d8d69e4a1d7d99ba57be29731e7ace010 /gcc/testsuite/gfortran.dg
parent94543d6987c66b013d7599bdccf58c2f37a4f12f (diff)
downloadgcc-14efb9b7b52e816aa93ea4a451b5c10eb7634a8b.tar.gz
2006-01-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/20869 PR fortran/20875 PR fortran/25024 * symbol.c (check_conflict): Add pointer valued elemental functions and internal procedures with the external attribute to the list of conflicts. (gfc_add_attribute): New catch-all function to perform the checking of symbol attributes for attribute declaration statements. * decl.c (attr_decl1): Call gfc_add_attribute for each of - (gfc_match_external, gfc_match_intent, gfc_match_intrinsic, gfc_match_pointer, gfc_match_dimension, gfc_match_target): Remove spurious calls to checks in symbol.c. Set the attribute directly and use the call to attr_decl() for checking. * gfortran.h: Add prototype for gfc_add_attribute. PR fortran/25785 * resolve.c (resolve_function): Exclude PRESENT from assumed size argument checking. Replace strcmp's with comparisons with generic codes. 2006-01-18 Paul Thomas <pault@gcc.gnu.org> Steven G. Kargl <kargls@comcast.net> PR fortran/20869 * gfortran.dg/intrinsic_external_1.f90: New test. PR fortran/20875. * gfortran.dg/elemental_pointer_1.f90: New test. PR fortran/25024 * gfortran.dg/external_procedures_1.f90: New test. PR fortran/25785 gfortran.dg/assumed_present.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109899 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg')
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_present.f909
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_pointer_1.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/external_procedures_1.f9041
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_external_1.f908
4 files changed, 69 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/assumed_present.f90 b/gcc/testsuite/gfortran.dg/assumed_present.f90
new file mode 100644
index 00000000000..dd9f85ca88f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/assumed_present.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! This tests the fix for the regression PR25785, where line 7 started
+! generating an assumed size error.
+! Contributed by Dale Ranta <dir@lanl.gov>
+ subroutine my_sio_file_write_common(data_c1)
+ character, intent(in), optional :: data_c1(*)
+ if (present(data_c1)) then
+ endif
+ end subroutine my_sio_file_write_common
diff --git a/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90 b/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
new file mode 100644
index 00000000000..b5d99611c78
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/elemental_pointer_1.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! Tests the fix for pr20875.
+! Note 12.7.1 "For a function, the result shall be scalar and shall not have the POINTER attribute."
+MODULE Test
+CONTAINS
+ ELEMENTAL FUNCTION LL(I)
+ INTEGER, INTENT(IN) :: I
+ INTEGER :: LL
+ POINTER :: LL ! { dg-error " POINTER attribute conflicts with ELEMENTAL attribute" }
+ END FUNCTION LL
+END MODULE Test
diff --git a/gcc/testsuite/gfortran.dg/external_procedures_1.f90 b/gcc/testsuite/gfortran.dg/external_procedures_1.f90
new file mode 100644
index 00000000000..95d0212353e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/external_procedures_1.f90
@@ -0,0 +1,41 @@
+! { dg-do compile }
+! This tests the patch for PR25024.
+
+! PR25024 - The external attribute for subroutine a would cause an ICE.
+ subroutine A ()
+ EXTERNAL A ! { dg-error "EXTERNAL attribute conflicts with SUBROUTINE" }
+ END
+function ext (y)
+ real ext, y
+ external ext ! { dg-error "EXTERNAL attribute conflicts with FUNCTION" }
+ ext = y * y
+end function ext
+
+function ext1 (y)
+ real ext1, y
+ external z ! OK no conflict
+ ext1 = y * y
+end function ext1
+
+program main
+ real ext, inval
+ external ext ! OK, valid external reference.
+ external main ! { dg-error "PROGRAM attribute conflicts with EXTERNAL" }
+ interface
+ function ext1 (y)
+ real ext1, y
+ external ext1 ! { dg-error "EXTERNAL attribute conflicts with FUNCTION" }
+ end function ext1
+ end interface
+ inval = 1.0
+ print *, ext(inval)
+ print *, ext1(inval)
+ print *, inv(inval)
+contains
+ function inv (y)
+ real inv, y
+ external inv ! { dg-error "EXTERNAL attribute conflicts with FUNCTION" }
+ inv = y * y * y
+ end function inv
+end program main
+
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_external_1.f90 b/gcc/testsuite/gfortran.dg/intrinsic_external_1.f90
new file mode 100644
index 00000000000..7d590126f52
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_external_1.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/20869
+! Note 12.11 "A name shall not appear in both an EXTERNAL and an
+! INTRINSIC statement in the same scoping unit.
+program u
+ intrinsic :: nint
+ external :: nint ! { dg-error "EXTERNAL attribute conflicts with INTRINSIC attribute" }
+end program u