re PR fortran/77765 (ICE in gfc_match_oacc_routine, at fortran/openmp.c:1781)

PR fortran/77765

	gcc/fortran/
	* openmp.c (gfc_match_oacc_routine): Check if proc_name exist before
	comparing the routine name against it.

	gcc/testsuite/
	* gfortran.dg/goacc/pr77765.f90: New test.

From-SVN: r249809
This commit is contained in:
Cesar Philippidis 2017-06-29 12:03:43 -07:00 committed by Cesar Philippidis
parent 6da4066f34
commit 74582a3e2e
4 changed files with 32 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-06-29 Cesar Philippidis <cesar@codesourcery.com>
PR fortran/77765
* openmp.c (gfc_match_oacc_routine): Check if proc_name exist before
comparing the routine name against it.
2017-06-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/80164

View File

@ -2295,7 +2295,8 @@ gfc_match_oacc_routine (void)
if (st)
{
sym = st->n.sym;
if (strcmp (sym->name, gfc_current_ns->proc_name->name) == 0)
if (gfc_current_ns->proc_name != NULL
&& strcmp (sym->name, gfc_current_ns->proc_name->name) == 0)
sym = NULL;
}

View File

@ -1,3 +1,8 @@
2017-06-29 Cesar Philippidis <cesar@codesourcery.com>
PR fortran/77765
* gfortran.dg/goacc/pr77765.f90: New test.
2017-06-29 Steve Ellcey <sellcey@cavium.com>
* gcc.target/aarch64/ccmp_2.c: New test.

View File

@ -0,0 +1,19 @@
! Test the presence of an ACC ROUTINE directive inside a function
! containg an error.
! { dg-do compile }
module m
contains
recursive function f(x)
end function f
recursive function f(x)
!$acc routine (f)
end function f
end module m
! { dg-error "Procedure 'f' at .1. is already defined" "" { target *-*-* } 8 }
! { dg-error "Duplicate RECURSIVE attribute specified" "" { target *-*-* } 8 }
! { dg-error ".1." "" { target *-*-* } 10 }
! { dg-error "Unexpected ..ACC ROUTINE" "" { target *-*-* } 11 }
! { dg-error "Expecting END MODULE statement" "" { target *-*-* } 12 }