gfortran.h (symbol_attribute): New 'untyped' field, fix comment formatting.
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Wed, 23 Feb 2005 20:56:58 +0000 (21:56 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Wed, 23 Feb 2005 20:56:58 +0000 (21:56 +0100)
fortran/
* gfortran.h (symbol_attribute): New 'untyped' field, fix comment
formatting.
* symbol.c (gfc_set_default_type): Issue error only once, by setting
and checking 'untyped' attribute.

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

From-SVN: r95469

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

index d099843cd123f3a8e8425dabda140eabbf45f176..b28e7070f63b57b69d428d9b8502e9be5877506a 100644 (file)
        (gfc_symbol_init_2): Pass second argument to gfc_get_namespace.
        * trans-common.c (build_common_decl): Likewise.
 
+       * gfortran.h (symbol_attribute): New 'untyped' field, fix comment
+       formatting.
+       * symbol.c (gfc_set_default_type): Issue error only once, by setting
+       and checking 'untyped' attribute.
+
 2005-02-23  Kazu Hirata  <kazu@cs.umass.edu>
 
        * intrinsic.h, st.c: Update copyright.
index 0778d65c70517f450e658f9eb92794ef95bf7965..f96cff10ddebb03688eca2a1a3b54282fd5ba1c0 100644 (file)
@@ -408,7 +408,8 @@ typedef struct
 
   unsigned in_namelist:1, in_common:1;
   unsigned function:1, subroutine:1, generic:1;
-  unsigned implicit_type:1;    /* Type defined via implicit rules */
+  unsigned implicit_type:1;    /* Type defined via implicit rules.  */
+  unsigned untyped:1;           /* No implicit type could be found.  */
 
   /* Function/subroutine attributes */
   unsigned sequence:1, elemental:1, pure:1, recursive:1;
index efe121111e024017132bd87e55f38f7cef0493ce..77d3f1a3a2d79ea832ffd6c475e95ab63f2c841f 100644 (file)
@@ -213,9 +213,12 @@ gfc_set_default_type (gfc_symbol * sym, int error_flag, gfc_namespace * ns)
 
   if (ts->type == BT_UNKNOWN)
     {
-      if (error_flag)
-       gfc_error ("Symbol '%s' at %L has no IMPLICIT type", sym->name,
-                  &sym->declared_at);
+      if (error_flag && !sym->attr.untyped)
+       {
+         gfc_error ("Symbol '%s' at %L has no IMPLICIT type",
+                    sym->name, &sym->declared_at);
+         sym->attr.untyped = 1; /* Ensure we only give an error once.  */
+       }
 
       return FAILURE;
     }
index e06a9790093860b6d17b7eb200a88df62c14bcdf..199acc114b74c1cce69dd8673c6c4fe516a7a60f 100644 (file)
@@ -2,6 +2,8 @@
 
        * gfortran.dg/implicit_3.f90: New test.
 
+       * gfortran.dg/deftype_1.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/deftype_1.f90 b/gcc/testsuite/gfortran.dg/deftype_1.f90
new file mode 100644 (file)
index 0000000..e0476d0
--- /dev/null
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! Checks for excess errors.
+implicit none
+dimension i(10) ! { dg-error "has no IMPLICIT type" }
+i = 2
+end