re PR fortran/32926 (ICE with external function as argument)
2007-08-13 Paul Thomas <pault@gcc.gnu.org> PR fortran/32926 * match.c (gfc_match_call): Do not create a new symtree in the case where the existing symbol is external and not referenced. 2007-08-13 Paul Thomas <pault@gcc.gnu.org> PR fortran/32926 * gfortran.dg/external_procedures_3.f90: New test. From-SVN: r127398
This commit is contained in:
parent
5a8af0b4ef
commit
eda0ed2597
@ -1,3 +1,9 @@
|
||||
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/32926
|
||||
* match.c (gfc_match_call): Do not create a new symtree in the
|
||||
case where the existing symbol is external and not referenced.
|
||||
|
||||
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/32827
|
||||
|
@ -2333,13 +2333,16 @@ gfc_match_call (void)
|
||||
if (!sym->attr.generic
|
||||
&& !sym->attr.subroutine)
|
||||
{
|
||||
/* ...create a symbol in this scope... */
|
||||
if (sym->ns != gfc_current_ns
|
||||
&& gfc_get_sym_tree (name, NULL, &st) == 1)
|
||||
return MATCH_ERROR;
|
||||
if (!(sym->attr.external && !sym->attr.referenced))
|
||||
{
|
||||
/* ...create a symbol in this scope... */
|
||||
if (sym->ns != gfc_current_ns
|
||||
&& gfc_get_sym_tree (name, NULL, &st) == 1)
|
||||
return MATCH_ERROR;
|
||||
|
||||
if (sym != st->n.sym)
|
||||
sym = st->n.sym;
|
||||
if (sym != st->n.sym)
|
||||
sym = st->n.sym;
|
||||
}
|
||||
|
||||
/* ...and then to try to make the symbol into a subroutine. */
|
||||
if (gfc_add_subroutine (&sym->attr, sym->name, NULL) == FAILURE)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/32926
|
||||
* gfortran.dg/external_procedures_3.f90: New test.
|
||||
|
||||
2007-08-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/32827
|
||||
|
35
gcc/testsuite/gfortran.dg/external_procedures_3.f90
Normal file
35
gcc/testsuite/gfortran.dg/external_procedures_3.f90
Normal file
@ -0,0 +1,35 @@
|
||||
! { dg-do run }
|
||||
! Tests the fix for PR32926, in which the call to fcn
|
||||
! in bar would cause an ICE because it had not been referenced
|
||||
! in the namespace where it was declared.
|
||||
!
|
||||
! Contributed by Ralph Baker Kearfott <rbk@louisiana.edu>
|
||||
!
|
||||
subroutine foobar1
|
||||
common // chr
|
||||
character(8) :: chr
|
||||
chr = "foobar1"
|
||||
end subroutine
|
||||
subroutine foobar2
|
||||
common // chr
|
||||
character(8) :: chr
|
||||
chr = "foobar2"
|
||||
end subroutine
|
||||
|
||||
subroutine foo (fcn)
|
||||
external fcn
|
||||
call bar
|
||||
contains
|
||||
subroutine bar
|
||||
call fcn
|
||||
end subroutine bar
|
||||
end subroutine foo
|
||||
|
||||
external foo, foobar1, foobar2
|
||||
common // chr
|
||||
character(8) :: chr
|
||||
call foo (foobar1)
|
||||
if (chr .ne. "foobar1") call abort ()
|
||||
call foo (foobar2)
|
||||
if (chr .ne. "foobar2") call abort ()
|
||||
end
|
Loading…
Reference in New Issue
Block a user