re PR fortran/39594 (compiler falls over in gfc_get_symbol_decl)
authorTobias Burnus <burnus@net-b.de>
Fri, 3 Apr 2009 18:26:44 +0000 (20:26 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Fri, 3 Apr 2009 18:26:44 +0000 (20:26 +0200)
2009-04-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/39594
        * resolve.c (resolve_common_vars): Add FL_VARIABLE to symbol
        if it is not a procedure pointer.
        * primary.c (match_actual_arg): Ditto.

2009-04-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/39594
        * gfortran.dg/common_12.f90: New.

From-SVN: r145513

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/common_12.f90 [new file with mode: 0644]

index 0b9bc88fe20eacaec324d7c8d25b0d43e0f718a1..f629bf214865c76cf9e1653f46bdfcafa968fce8 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-03  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/39594
+       * resolve.c (resolve_common_vars): Add FL_VARIABLE to symbol
+       if it is not a procedure pointer.
+       * primary.c (match_actual_arg): Ditto.
+
 2009-03-31  Joseph Myers  <joseph@codesourcery.com>
 
        PR preprocessor/15638
index c7ca861a273312d9138c30a042bab1eec8090f99..cb6f98883b0f648add319ab8896203cc1f79a0dd 100644 (file)
@@ -1401,6 +1401,13 @@ match_actual_arg (gfc_expr **result)
              && sym->attr.flavor != FL_UNKNOWN)
            break;
 
+         if (sym->attr.in_common && !sym->attr.proc_pointer)
+           {
+             gfc_add_flavor (&sym->attr, FL_VARIABLE, sym->name,
+                             &sym->declared_at);
+             break;
+           }
+
          /* If the symbol is a function with itself as the result and
             is being defined, then we have a variable.  */
          if (sym->attr.function && sym->result == sym)
index 1fa1a79e23aa1418669e361852f548723035c111..32b13e4aabcb2825e882650a7212f761cbc40c21 100644 (file)
@@ -719,6 +719,9 @@ resolve_common_vars (gfc_symbol *sym, bool named_common)
        gfc_error_now ("Derived type variable '%s' in COMMON at %L "
                       "may not have default initializer", csym->name,
                       &csym->declared_at);
+
+      if (csym->attr.flavor == FL_UNKNOWN && !csym->attr.proc_pointer)
+       gfc_add_flavor (&csym->attr, FL_VARIABLE, csym->name, &csym->declared_at);
     }
 }
 
index 2d697b1ea9732b21d7532833c6ba7ef0c930d86d..9f945cdfb312384798e6bf04c542c75e79f9409d 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-03  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/39594
+       * gfortran.dg/common_12.f90: New.
+
 2009-04-03  Jason Merrill  <jason@redhat.com>
 
        PR c++/39608
diff --git a/gcc/testsuite/gfortran.dg/common_12.f90 b/gcc/testsuite/gfortran.dg/common_12.f90
new file mode 100644 (file)
index 0000000..0eea80f
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR fortran/39594
+!
+! Contributed by Peter Knowles and reduced by Jakub Jelinek.
+!
+module pr39594
+  implicit double precision(z)
+  common /z/ z0,z1,z2,z3,z4,z5,z6,z7
+contains
+  subroutine foo
+    implicit double precision(z)
+    common /z/ z0,z1,z2,z3,z4,z5,z6,z7
+    call bar(z0)
+  end subroutine foo
+end module
+
+! { dg-final { cleanup-modules "pr39594" } }