fortran/
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Feb 2005 19:02:29 +0000 (19:02 +0000)
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Feb 2005 19:02:29 +0000 (19:02 +0000)
* gfortran.h (gfc_get_namespace): Add second argument to prototype.
* intrinsic.c (gfc_intrinsic_init_1): Pass second argument to
gfc_get_namespace.
* module.c (mio_namespace_ref, load_needed): Likewise.
* parse.c (parse_interface, parse_contained): Likewise.  Here the
correct second argument matters.
* symbol.c (gfc_get_namespace): Add parent_types argument, only copy
parent's implicit types if this is set.
(gfc_symbol_init_2): Pass second argument to gfc_get_namespace.
* trans-common.c (build_common_decl): Likewise.

testsuite/
* gfortran.dg/implicit_3.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95463 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/gfortran.h
gcc/fortran/intrinsic.c
gcc/fortran/module.c
gcc/fortran/parse.c
gcc/fortran/symbol.c
gcc/fortran/trans-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/implicit_3.f90 [new file with mode: 0644]

index 5f22cc3..d099843 100644 (file)
@@ -1,3 +1,16 @@
+2005-02-23  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * gfortran.h (gfc_get_namespace): Add second argument to prototype.
+       * intrinsic.c (gfc_intrinsic_init_1): Pass second argument to
+       gfc_get_namespace.
+       * module.c (mio_namespace_ref, load_needed): Likewise.
+       * parse.c (parse_interface, parse_contained): Likewise.  Here the
+       correct second argument matters.
+       * symbol.c (gfc_get_namespace): Add parent_types argument, only copy
+       parent's implicit types if this is set.
+       (gfc_symbol_init_2): Pass second argument to gfc_get_namespace.
+       * trans-common.c (build_common_decl): Likewise.
+
 2005-02-23  Kazu Hirata  <kazu@cs.umass.edu>
 
        * intrinsic.h, st.c: Update copyright.
index 9df2f37..0778d65 100644 (file)
@@ -1619,7 +1619,7 @@ void gfc_free_st_label (gfc_st_label *);
 void gfc_define_st_label (gfc_st_label *, gfc_sl_type, locus *);
 try gfc_reference_st_label (gfc_st_label *, gfc_sl_type);
 
-gfc_namespace *gfc_get_namespace (gfc_namespace *);
+gfc_namespace *gfc_get_namespace (gfc_namespace *, int);
 gfc_symtree *gfc_new_symtree (gfc_symtree **, const char *);
 gfc_symtree *gfc_find_symtree (gfc_symtree *, const char *);
 gfc_user_op *gfc_get_uop (const char *);
index f28317c..f9642c7 100644 (file)
@@ -2241,7 +2241,7 @@ gfc_intrinsic_init_1 (void)
   nargs = nfunc = nsub = nconv = 0;
 
   /* Create a namespace to hold the resolved intrinsic symbols.  */
-  gfc_intrinsic_namespace = gfc_get_namespace (NULL);
+  gfc_intrinsic_namespace = gfc_get_namespace (NULL, 0);
 
   sizing = SZ_FUNCS;
   add_functions ();
index 12d52c4..ff3dcff 100644 (file)
@@ -2627,7 +2627,7 @@ mio_namespace_ref (gfc_namespace ** nsp)
       ns = (gfc_namespace *)p->u.pointer;
       if (ns == NULL)
        {
-         ns = gfc_get_namespace (NULL);
+         ns = gfc_get_namespace (NULL, 0);
          associate_integer_pointer (p, ns);
        }
       else
@@ -2878,7 +2878,7 @@ load_needed (pointer_info * p)
             the namespaces that hold the formal parameters of module
             procedures.  */
 
-         ns = gfc_get_namespace (NULL);
+         ns = gfc_get_namespace (NULL, 0);
          associate_integer_pointer (q, ns);
        }
 
index dac4077..a3f0ac1 100644 (file)
@@ -1405,7 +1405,7 @@ parse_interface (void)
   current_state = COMP_NONE;
 
 loop:
-  gfc_current_ns = gfc_get_namespace (current_interface.ns);
+  gfc_current_ns = gfc_get_namespace (current_interface.ns, 0);
 
   st = next_statement ();
   switch (st)
@@ -2170,7 +2170,7 @@ parse_contained (int module)
 
   do
     {
-      gfc_current_ns = gfc_get_namespace (parent_ns);
+      gfc_current_ns = gfc_get_namespace (parent_ns, 1);
 
       gfc_current_ns->sibling = parent_ns->contained;
       parent_ns->contained = gfc_current_ns;
index 702a387..efe1211 100644 (file)
@@ -1531,10 +1531,11 @@ done:
    this case, that symbol has been used as a host associated variable
    at some previous time.  */
 
-/* Allocate a new namespace structure.  */
+/* Allocate a new namespace structure.  Copies the implicit types from
+   PARENT if PARENT_TYPES is set.  */
 
 gfc_namespace *
-gfc_get_namespace (gfc_namespace * parent)
+gfc_get_namespace (gfc_namespace * parent, int parent_types)
 {
   gfc_namespace *ns;
   gfc_typespec *ts;
@@ -1556,7 +1557,7 @@ gfc_get_namespace (gfc_namespace * parent)
       ns->set_flag[i - 'a'] = 0;
       ts = &ns->default_type[i - 'a'];
 
-      if (ns->parent != NULL)
+      if (parent_types && ns->parent != NULL)
        {
          /* Copy parent settings */
          *ts = ns->parent->default_type[i - 'a'];
@@ -2243,7 +2244,7 @@ void
 gfc_symbol_init_2 (void)
 {
 
-  gfc_current_ns = gfc_get_namespace (NULL);
+  gfc_current_ns = gfc_get_namespace (NULL, 0);
 }
 
 
index 6a6e139..35ea801 100644 (file)
@@ -288,7 +288,7 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
 
   /* Create a namespace to store symbols for common blocks.  */
   if (gfc_common_ns == NULL)
-    gfc_common_ns = gfc_get_namespace (NULL);
+    gfc_common_ns = gfc_get_namespace (NULL, 0);
 
   gfc_get_symbol (com->name, gfc_common_ns, &common_sym);
   decl = common_sym->backend_decl;
index 408b0c2..e06a979 100644 (file)
@@ -1,3 +1,7 @@
+2005-02-23  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       * gfortran.dg/implicit_3.f90: New test.
+
 2005-02-23  Alexandre Oliva  <aoliva@redhat.com>
 
        * g++.dg/lookup/anon2.C: Don't let access checks make it look like
diff --git a/gcc/testsuite/gfortran.dg/implicit_3.f90 b/gcc/testsuite/gfortran.dg/implicit_3.f90
new file mode 100644 (file)
index 0000000..830b861
--- /dev/null
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! Verify that INTERFACEs don't inherit the implicit types of the
+! surrounding namespace.
+implicit complex (i-k)
+
+interface
+   function f(k,l)
+     ! k should be default INTEGER 
+     dimension l(k)
+   end function f
+end interface
+end