From: Jerry DeLisle Date: Sun, 26 Jun 2016 01:03:19 +0000 (+0000) Subject: re PR fortran/71649 (Internal compiler error) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46db0fd456f0ecca6411c7b4de2a00c54d141fa0;p=gcc.git re PR fortran/71649 (Internal compiler error) 2016-06-25 Jerry DeLisle PR fortran/71649 * module.c (create_intrinsic_function): Check for NULL values and return after giving error. PR fortran/71649 * gfortran.dg/pr71649.f90: New test. From-SVN: r237789 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9b4b957b109..b8cadceb591 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-06-25 Jerry DeLisle + + PR fortran/71649 + * module.c (create_intrinsic_function): Check for NULL values and + return after giving error. + 2016-06-21 Michael Meissner * trans-types.c (gfc_build_complex_type): Move setting complex diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 6d3860ef826..4d664f079f5 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -6159,9 +6159,11 @@ create_intrinsic_function (const char *name, int id, tmp_symtree = gfc_find_symtree (gfc_current_ns->sym_root, name); if (tmp_symtree) { - if (strcmp (modname, tmp_symtree->n.sym->module) == 0) - return; - gfc_error ("Symbol %qs already declared", name); + if (tmp_symtree->n.sym && tmp_symtree->n.sym->module + && strcmp (modname, tmp_symtree->n.sym->module) == 0) + return; + gfc_error ("Symbol %qs at %C already declared", name); + return; } gfc_get_sym_tree (name, gfc_current_ns, &tmp_symtree, false); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68172b39e8b..13c9ce2e5c2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-06-25 Jerry DeLisle + + PR fortran/71649 + * gfortran.dg/pr71649.f90: New test. + 2016-06-25 Jakub Jelinek PR tree-optimization/71643 diff --git a/gcc/testsuite/gfortran.dg/pr71649.f90 b/gcc/testsuite/gfortran.dg/pr71649.f90 new file mode 100644 index 00000000000..f20b7687e6f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71649.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } +! PR71649 Internal Compiler Error +SUBROUTINE Compiler_Options ( Options, Version, WriteOpt ) + USE ISO_FORTRAN_ENV, ONLY : Compiler_Version, Compiler_Options ! { dg-error "already declared" } + IMPLICIT NONE + CHARACTER (LEN=*), INTENT(OUT) :: Options + CHARACTER (LEN=*), INTENT(OUT) :: Version + LOGICAL, INTENT(IN), OPTIONAL :: WriteOpt + Version = Compiler_Version() + Options = Compiler_Options() ! { dg-error "Unexpected use of subroutine name" } + RETURN +END SUBROUTINE Compiler_Options +