re PR fortran/41755 (Segfault on invalid code)
authorTobias Burnus <burnus@net-b.de>
Mon, 19 Oct 2009 18:03:02 +0000 (20:03 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Mon, 19 Oct 2009 18:03:02 +0000 (20:03 +0200)
2009-10-19  Tobias Burnus  <burnus@net-b.de>
            Steven G. Kargl  <kargl@gcc.gnu.org>

        PR fortran/41755
        * symbol.c (gfc_undo_symbols): Add NULL check.
        * match.c (gfc_match_equivalence): Add check for
        missing comma.

2009-10-19  Tobias Burnus  <burnus@net-b.de>

        PR fortran/41755
        * gfortran.dg/equiv_8.f90: New test.
        * gfortran.dg/class_allocate_1.f03: Remove obsolete FIXME.

Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>
From-SVN: r152983

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/class_allocate_1.f03
gcc/testsuite/gfortran.dg/equiv_8.f90 [new file with mode: 0644]

index b90f9c5..3f07da5 100644 (file)
@@ -1,3 +1,11 @@
+2009-10-19  Tobias Burnus  <burnus@net-b.de>
+           Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/41755
+       * symbol.c (gfc_undo_symbols): Add NULL check.
+       * match.c (gfc_match_equivalence): Add check for
+       missing comma.
+
 2009-10-19  Richard Guenther  <rguenther@suse.de>
 
        PR fortran/41494
index d75ef0e..8721606 100644 (file)
@@ -3750,7 +3750,10 @@ gfc_match_equivalence (void)
       if (gfc_match_eos () == MATCH_YES)
        break;
       if (gfc_match_char (',') != MATCH_YES)
-       goto syntax;
+       {
+         gfc_error ("Expecting a comma in EQUIVALENCE at %C");
+         goto cleanup;
+       }
     }
 
   return MATCH_YES;
index 2641df8..837a357 100644 (file)
@@ -2741,7 +2741,7 @@ gfc_undo_symbols (void)
       if (p->gfc_new)
        {
          /* Symbol was new.  */
-         if (p->attr.in_common && p->common_block->head)
+         if (p->attr.in_common && p->common_block && p->common_block->head)
            {
              /* If the symbol was added to any common block, it
                 needs to be removed to stop the resolver looking
index 0042764..bce4d7c 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-19  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/41755
+       * gfortran.dg/equiv_8.f90: New test.
+       * gfortran.dg/class_allocate_1.f03: Remove obsolete FIXME.
+
 2009-10-19  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.target/arm/neon-thumb2-move.c: New test.
index 719d90c..67c8065 100644 (file)
@@ -68,8 +68,7 @@
 
  i = 0
  allocate(t2 :: cp2)
-! FIXME: Not yet supported: source=<class>
-! allocate(cp, source = cp2)
+ allocate(cp, source = cp2)
  allocate(t2 :: cp3)
  allocate(cp, source=cp3)
  select type (cp)
diff --git a/gcc/testsuite/gfortran.dg/equiv_8.f90 b/gcc/testsuite/gfortran.dg/equiv_8.f90
new file mode 100644 (file)
index 0000000..a2ed7f0
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+!
+! PR fortran/41755
+!
+      common /uno/ aa
+      equivalence (aa,aaaaa)   (bb,cc) ! { dg-error "Expecting a comma in EQUIVALENCE" }
+      end