re PR fortran/71649 (Internal compiler error)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 26 Jun 2016 01:03:19 +0000 (01:03 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 26 Jun 2016 01:03:19 +0000 (01:03 +0000)
2016-06-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

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

gcc/fortran/ChangeLog
gcc/fortran/module.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr71649.f90 [new file with mode: 0644]

index 9b4b957b1096a900ff26e52f58fbfcf6bf99341b..b8cadceb5910c64d11bf1a461349b9fad4025de3 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/71649
+       * module.c (create_intrinsic_function): Check for NULL values and
+       return after giving error.
+
 2016-06-21  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * trans-types.c (gfc_build_complex_type): Move setting complex
index 6d3860ef826e0165318fbe7a287ba6a81d078a76..4d664f079f5a9c4e71c0af14f3bc8415a5cd2190 100644 (file)
@@ -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);
index 68172b39e8b3b2d9d83f0746a5e8f4fd5a613a54..13c9ce2e5c2bf34b35e63d371bf429f628336182 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-25  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/71649
+       * gfortran.dg/pr71649.f90: New test.
+
 2016-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/71643
diff --git a/gcc/testsuite/gfortran.dg/pr71649.f90 b/gcc/testsuite/gfortran.dg/pr71649.f90
new file mode 100644 (file)
index 0000000..f20b768
--- /dev/null
@@ -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
+