From 5b0b27f9c3c9efaa75187a740b8a5ed6b32a865d Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Mon, 16 Dec 2013 23:01:58 +0100 Subject: [PATCH] re PR fortran/54949 ([F03] abstract procedure pointers not rejected) 2013-12-16 Janus Weil PR fortran/54949 * symbol.c (check_conflict): Forbid abstract procedure pointers. (gfc_add_abstract): Check for attribute conflicts. 2013-12-16 Janus Weil PR fortran/54949 * gfortran.dg/proc_ptr_44.f90: New. From-SVN: r206033 --- gcc/fortran/ChangeLog | 6 +++++ gcc/fortran/symbol.c | 6 ++++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gfortran.dg/proc_ptr_44.f90 | 29 +++++++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/proc_ptr_44.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4f3a8e16a0e..1a81bfcc0cc 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-12-16 Janus Weil + + PR fortran/54949 + * symbol.c (check_conflict): Forbid abstract procedure pointers. + (gfc_add_abstract): Check for attribute conflicts. + 2013-12-16 Jakub Jelinek PR libgomp/59337 diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 9d23e8b48a3..07930f2916d 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -363,6 +363,7 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) *cray_pointee = "CRAY POINTEE", *data = "DATA", *value = "VALUE", *volatile_ = "VOLATILE", *is_protected = "PROTECTED", *is_bind_c = "BIND(C)", *procedure = "PROCEDURE", + *proc_pointer = "PROCEDURE POINTER", *abstract = "ABSTRACT", *asynchronous = "ASYNCHRONOUS", *codimension = "CODIMENSION", *contiguous = "CONTIGUOUS", *generic = "GENERIC"; static const char *threadprivate = "THREADPRIVATE"; @@ -593,6 +594,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) conf (procedure, asynchronous) conf (procedure, entry) + conf (proc_pointer, abstract) + a1 = gfc_code2string (flavors, attr->flavor); if (attr->in_namelist @@ -1440,7 +1443,8 @@ gfc_add_abstract (symbol_attribute* attr, locus* where) } attr->abstract = 1; - return true; + + return check_conflict (attr, NULL, where); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79047575c55..671a8b5f30a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-12-16 Janus Weil + + PR fortran/54949 + * gfortran.dg/proc_ptr_44.f90: New. + 2013-12-16 Jakub Jelinek * c-c++-common/ubsan/overflow-mul-3.c: New test. diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_44.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_44.f90 new file mode 100644 index 00000000000..3ed65a88b58 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_44.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! +! PR 54949: [F03] abstract procedure pointers not rejected +! +! Contributed by Janus Weil + + implicit none + + abstract interface + subroutine abssub1 + end subroutine + end interface + pointer :: abssub1 ! { dg-error "PROCEDURE POINTER attribute conflicts with ABSTRACT attribute" } + + pointer :: abssub2 + abstract interface + subroutine abssub2 ! { dg-error "PROCEDURE POINTER attribute conflicts with ABSTRACT attribute" } + end subroutine + end interface + + abssub1 => sub ! { dg-error "is not a variable" } + abssub2 => sub + +contains + + subroutine sub + end subroutine + +end