]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorNicolas Koenig <koenigni@student.ethz.ch>
Tue, 4 Apr 2017 13:41:41 +0000 (15:41 +0200)
committerNicolas Koenig <koenigni@gcc.gnu.org>
Tue, 4 Apr 2017 13:41:41 +0000 (13:41 +0000)
2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch>
PR fortran/69498
* symbol.c (gfc_delete_symtree): If there is a period in the name, ignore
everything before it.

2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch>
PR fortran/69498
* gfortran.dg/submodule_unexp.f90: New test.

From-SVN: r246679

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

index 7528f37a02025f600d080d3e5c307b4fc8cb9de2..e1057d72eb884294682c92cd86ca8a9324ee0575 100644 (file)
@@ -1,3 +1,9 @@
+2017-03-18  Nicolas Koenig  <koenigni@student.ethz.ch> 
+
+       PR fortran/69498
+       * symbol.c (gfc_delete_symtree): If there is a period in the name, ignore
+       everything before it.
+
 2017-03-28  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/78661
index 6226bca7bec11c7daf662fca8e3083fae19933ad..ec43e635bf3688f52b3bc21498f4995b9f1ecb59 100644 (file)
@@ -2782,10 +2782,20 @@ void
 gfc_delete_symtree (gfc_symtree **root, const char *name)
 {
   gfc_symtree st, *st0;
+  const char *p;
 
-  st0 = gfc_find_symtree (*root, name);
+  /* Submodules are marked as mod.submod.  When freeing a submodule
+     symbol, the symtree only has "submod", so adjust that here.  */
 
-  st.name = gfc_get_string ("%s", name);
+  p = strrchr(name, '.');
+  if (p)
+    p++;
+  else
+    p = name;
+
+  st0 = gfc_find_symtree (*root, p);
+
+  st.name = gfc_get_string ("%s", p);
   gfc_delete_bbt (root, &st, compare_symtree);
 
   free (st0);
index e14af29e2b94fb40c3dcbba19d54a9c680c814d6..2d5f91aa81e31f724943164717bbf30c5a43cf6d 100644 (file)
@@ -1,3 +1,8 @@
+2017-04-04  Nicolas Koenig  <koenigni@student.ethz.ch> 
+
+       PR fortran/69498
+       * gfortran.dg/submodule_unexp.f90: New test.
+
 2017-04-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/80286
diff --git a/gcc/testsuite/gfortran.dg/submodule_unexp.f90 b/gcc/testsuite/gfortran.dg/submodule_unexp.f90
new file mode 100644 (file)
index 0000000..43a0553
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/69498
+! This used to ICE
+program p
+   type t
+   submodule (m) sm ! { dg-error "Unexpected SUBMODULE statement at" }
+   end type
+end