diff options
author | Tobias Burnus <burnus@net-b.de> | 2007-09-13 20:03:39 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2007-09-13 20:03:39 +0200 |
commit | 10a6db6ef3704c55bebf354218fcd9166800f543 (patch) | |
tree | 2860cd0d26ff39818b3a1b52fb1369063d43bef5 /gcc | |
parent | e3bfd8f4169dbe03574a3ce1efc91d23f5877f9c (diff) | |
download | gcc-10a6db6ef3704c55bebf354218fcd9166800f543.zip gcc-10a6db6ef3704c55bebf354218fcd9166800f543.tar.gz gcc-10a6db6ef3704c55bebf354218fcd9166800f543.tar.bz2 |
symbol.c (gfc_add_elemental,gfc_add_pure,gfc_add_recursive): Allow prefixes only to be specified once.
2007-09-13 Tobias Burnus <burnus@net-b.de>
* symbol.c (gfc_add_elemental,gfc_add_pure,gfc_add_recursive):
Allow prefixes only to be specified once.
2007-09-13 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/recursive_check_3.f90: New.
From-SVN: r128472
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/symbol.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/recursive_check_3.f90 | 22 |
4 files changed, 49 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0b1eca4..73dcbf8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,10 @@ 2007-09-13 Tobias Burnus <burnus@net-b.de> + * symbol.c (gfc_add_elemental,gfc_add_pure,gfc_add_recursive): + Allow prefixes only to be specified once. + +2007-09-13 Tobias Burnus <burnus@net-b.de> + PR fortran/33412 * symbol.c (check_conflict): Add conflict of ELEMENTAL with Bind(C). diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 01f64e2..6ed366f 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1144,6 +1144,12 @@ gfc_add_elemental (symbol_attribute *attr, locus *where) if (check_used (attr, NULL, where)) return FAILURE; + if (attr->elemental) + { + duplicate_attr ("ELEMENTAL", where); + return FAILURE; + } + attr->elemental = 1; return check_conflict (attr, NULL, where); } @@ -1156,6 +1162,12 @@ gfc_add_pure (symbol_attribute *attr, locus *where) if (check_used (attr, NULL, where)) return FAILURE; + if (attr->pure) + { + duplicate_attr ("PURE", where); + return FAILURE; + } + attr->pure = 1; return check_conflict (attr, NULL, where); } @@ -1168,6 +1180,12 @@ gfc_add_recursive (symbol_attribute *attr, locus *where) if (check_used (attr, NULL, where)) return FAILURE; + if (attr->recursive) + { + duplicate_attr ("RECURSIVE", where); + return FAILURE; + } + attr->recursive = 1; return check_conflict (attr, NULL, where); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd4a00c..9df45f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2007-09-13 Tobias Burnus <burnus@net-b.de> + * gfortran.dg/recursive_check_3.f90: New. + +2007-09-13 Tobias Burnus <burnus@net-b.de> + PR fortran/33412 * gfortran.dg/elemental_bind_c.f90: New. diff --git a/gcc/testsuite/gfortran.dg/recursive_check_3.f90 b/gcc/testsuite/gfortran.dg/recursive_check_3.f90 new file mode 100644 index 0000000..23904a8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/recursive_check_3.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! +module m1 +contains +pure pure subroutine a1(b) ! { dg-error "Duplicate PURE attribute specified" } + real, intent(in) :: b ! { dg-error "Unexpected data declaration statement" } +end subroutine a1 ! { dg-error "Expecting END MODULE" } +end module m1 ! { dg-warning "CONTAINS statement without FUNCTION" } + +module m2 +contains +elemental elemental subroutine a2(b) ! { dg-error "Duplicate ELEMENTAL attribute" } + real, intent(in) :: b ! { dg-error "Unexpected data declaration statement" } +end subroutine a2 ! { dg-error "Expecting END MODULE" } +end module m2 ! { dg-warning "CONTAINS statement without FUNCTION" } + +module m3 +contains +recursive recursive subroutine a3(b) ! { dg-error "Duplicate RECURSIVE attribute" } + real, intent(in) :: b ! { dg-error "Unexpected data declaration statement" } +end subroutine a3 ! { dg-error "Expecting END MODULE" } +end module m3 ! { dg-warning "CONTAINS statement without FUNCTION" } |