Commit beb4bd6c by Janus Weil

re PR fortran/36705 (Procedure pointers with attributes statements)

2008-08-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/36705
	* symbol.c (check_conflict): Move conflict checks for (procedure,save)
	and (procedure,intent) to resolve_fl_procedure.
	* resolve.c (resolve_fl_procedure): Ditto.


2008-08-14  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/36705
	* gfortran.dg/argument_checking_7.f90: Modified.
	* gfortran.dg/conflicts.f90: Modified.
	* gfortran.dg/proc_decl_1.f90: Modified.
	* gfortran.dg/proc_ptr_9.f90: New.

From-SVN: r139116
parent 157b0647
2008-08-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/36705
* symbol.c (check_conflict): Move conflict checks for (procedure,save)
and (procedure,intent) to resolve_fl_procedure.
* resolve.c (resolve_fl_procedure): Ditto.
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 36901 PR 36901
......
...@@ -7443,6 +7443,20 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) ...@@ -7443,6 +7443,20 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
} }
} }
if (sym->attr.save == SAVE_EXPLICIT && !sym->attr.proc_pointer)
{
gfc_error ("PROCEDURE attribute conflicts with SAVE attribute "
"in '%s' at %L", sym->name, &sym->declared_at);
return FAILURE;
}
if (sym->attr.intent && !sym->attr.proc_pointer)
{
gfc_error ("PROCEDURE attribute conflicts with INTENT attribute "
"in '%s' at %L", sym->name, &sym->declared_at);
return FAILURE;
}
return SUCCESS; return SUCCESS;
} }
......
...@@ -417,12 +417,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) ...@@ -417,12 +417,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
goto conflict; goto conflict;
case FL_PROCEDURE: case FL_PROCEDURE:
if (attr->proc_pointer) /* Conflicts between SAVE and PROCEDURE will be checked at
break; resolution stage, see "resolve_fl_procedure". */
a1 = gfc_code2string (flavors, attr->flavor);
a2 = save;
goto conflict;
case FL_VARIABLE: case FL_VARIABLE:
case FL_NAMELIST: case FL_NAMELIST:
default: default:
...@@ -618,8 +614,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) ...@@ -618,8 +614,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where)
break; break;
case FL_PROCEDURE: case FL_PROCEDURE:
if (!attr->proc_pointer) /* Conflicts with INTENT will be checked at resolution stage,
conf2 (intent); see "resolve_fl_procedure". */
if (attr->subroutine) if (attr->subroutine)
{ {
......
2008-08-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/36705
* gfortran.dg/argument_checking_7.f90: Modified.
* gfortran.dg/conflicts.f90: Modified.
* gfortran.dg/proc_decl_1.f90: Modified.
* gfortran.dg/proc_ptr_9.f90: New.
2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> 2008-08-14 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/34485 PR c++/34485
......
...@@ -12,7 +12,7 @@ module cyclic ...@@ -12,7 +12,7 @@ module cyclic
character(len(y)-1) ouch character(len(y)-1) ouch
integer i integer i
do i = 1, len(ouch) do i = 1, len(ouch)
ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i)))) ! { dg-error " PROCEDURE attribute conflicts" } ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i)))) ! { dg-error "Syntax error in argument list" }
end do end do
end function ouch end function ouch
end module cyclic end module cyclic
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
! Check for conflicts ! Check for conflicts
! PR fortran/29657 ! PR fortran/29657
function f1() ! { dg-error "has no IMPLICIT type" } function f1() ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" }
implicit none implicit none
real, save :: f1 ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" } real, save :: f1
f1 = 1.0 f1 = 1.0
end function f1 end function f1
function f2() function f2() ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" }
implicit none implicit none
real :: f2 real :: f2
save f2 ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" } save f2
f2 = 1.0 f2 = 1.0
end function f2 end function f2
......
...@@ -53,13 +53,13 @@ program prog ...@@ -53,13 +53,13 @@ program prog
contains contains
subroutine foo(a,c) subroutine foo(a,c) ! { dg-error "PROCEDURE attribute conflicts with INTENT attribute" }
abstract interface abstract interface
subroutine b() bind(C) subroutine b() bind(C)
end subroutine b end subroutine b
end interface end interface
procedure(b), bind(c,name="hjj") :: a ! { dg-error "may not have BIND.C. attribute with NAME" } procedure(b), bind(c,name="hjj") :: a ! { dg-error "may not have BIND.C. attribute with NAME" }
procedure(c),intent(in):: c ! { dg-error "PROCEDURE attribute conflicts with INTENT attribute" } procedure(b),intent(in):: c
end subroutine foo end subroutine foo
end program end program
......
! { dg-do compile }
!
! PR fortran/36705
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
save :: p
procedure() :: p
pointer :: p
contains
subroutine bar(x)
procedure(), intent(in) :: x
pointer :: x
end subroutine bar
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment