re PR fortran/82796 (Private+equivalence in used module breaks compilation of pure function)
2017-11-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82796 * resolve.c (resolve_equivalence): An entity in a common block within a module cannot appear in an equivalence statement if the entity is with a pure procedure. 2017-11-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/82796 * gfortran.dg/equiv_pure.f90: New test. From-SVN: r254403
This commit is contained in:
parent
da768c5b5c
commit
9cfdd48417
4 changed files with 80 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
|||
2017-11-03 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/82796
|
||||
* resolve.c (resolve_equivalence): An entity in a common block within
|
||||
a module cannot appear in an equivalence statement if the entity is
|
||||
with a pure procedure.
|
||||
|
||||
2017-10-31 Jim Wilson <wilson@tuliptree.org>
|
||||
|
||||
* parse.c (unexpected_eof): Call gcc_unreachable before return.
|
||||
|
|
|
@ -15936,9 +15936,22 @@ resolve_equivalence (gfc_equiv *eq)
|
|||
&& sym->ns->proc_name->attr.pure
|
||||
&& sym->attr.in_common)
|
||||
{
|
||||
gfc_error ("Common block member %qs at %L cannot be an EQUIVALENCE "
|
||||
"object in the pure procedure %qs",
|
||||
sym->name, &e->where, sym->ns->proc_name->name);
|
||||
/* Need to check for symbols that may have entered the pure
|
||||
procedure via a USE statement. */
|
||||
bool saw_sym = false;
|
||||
if (sym->ns->use_stmts)
|
||||
{
|
||||
gfc_use_rename *r;
|
||||
for (r = sym->ns->use_stmts->rename; r; r = r->next)
|
||||
if (strcmp(r->use_name, sym->name) == 0) saw_sym = true;
|
||||
}
|
||||
else
|
||||
saw_sym = true;
|
||||
|
||||
if (saw_sym)
|
||||
gfc_error ("COMMON block member %qs at %L cannot be an "
|
||||
"EQUIVALENCE object in the pure procedure %qs",
|
||||
sym->name, &e->where, sym->ns->proc_name->name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2017-11-03 Steven G. Kargl <kargl@gcc.gnu.org>
|
||||
|
||||
PR fortran/82796
|
||||
* gfortran.dg/equiv_pure.f90: New test.
|
||||
|
||||
2017-11-03 Jeff Law <law@redhat.com>
|
||||
|
||||
PR target/82823
|
||||
|
|
52
gcc/testsuite/gfortran.dg/equiv_pure.f90
Normal file
52
gcc/testsuite/gfortran.dg/equiv_pure.f90
Normal file
|
@ -0,0 +1,52 @@
|
|||
! { dg-do compile }
|
||||
! PR fortran/82796
|
||||
! Code contributed by ripero84 at gmail dot com
|
||||
module eq
|
||||
implicit none
|
||||
integer :: n1, n2
|
||||
integer, dimension(2) :: a
|
||||
equivalence (a(1), n1)
|
||||
equivalence (a(2), n2)
|
||||
common /a/ a
|
||||
end module eq
|
||||
|
||||
module m
|
||||
use eq
|
||||
implicit none
|
||||
type, public :: t
|
||||
integer :: i
|
||||
end type t
|
||||
end module m
|
||||
|
||||
module p
|
||||
implicit none
|
||||
contains
|
||||
pure integer function d(h)
|
||||
use m
|
||||
implicit none
|
||||
integer, intent(in) :: h
|
||||
d = h
|
||||
end function
|
||||
end module p
|
||||
|
||||
module q
|
||||
implicit none
|
||||
contains
|
||||
pure integer function d(h)
|
||||
use m, only : t
|
||||
implicit none
|
||||
integer, intent(in) :: h
|
||||
d = h
|
||||
end function
|
||||
end module q
|
||||
|
||||
module r
|
||||
implicit none
|
||||
contains
|
||||
pure integer function d(h)
|
||||
use m, only : a ! { dg-error "cannot be an EQUIVALENCE object" }
|
||||
implicit none
|
||||
integer, intent(in) :: h
|
||||
d = h
|
||||
end function
|
||||
end module r
|
Loading…
Add table
Reference in a new issue