From: Cesar Philippidis Date: Thu, 29 Jun 2017 19:03:43 +0000 (-0700) Subject: re PR fortran/77765 (ICE in gfc_match_oacc_routine, at fortran/openmp.c:1781) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74582a3e2e01068437410fb75f2f9282ee4923e3;p=gcc.git 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fbf0b4ded40..e9043dd1cdf 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2017-06-29 Cesar Philippidis + + 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 PR fortran/80164 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 2b56558b7c1..8400354181c 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8aba9c2fd41..8fe42baf912 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-29 Cesar Philippidis + + PR fortran/77765 + * gfortran.dg/goacc/pr77765.f90: New test. + 2017-06-29 Steve Ellcey * gcc.target/aarch64/ccmp_2.c: New test. diff --git a/gcc/testsuite/gfortran.dg/goacc/pr77765.f90 b/gcc/testsuite/gfortran.dg/goacc/pr77765.f90 new file mode 100644 index 00000000000..3819cf70c04 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/pr77765.f90 @@ -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 }