(check_format): Don't crash if cur_type is an error_mark.
authorRichard Stallman <rms@gnu.org>
Wed, 16 Jun 1993 20:27:18 +0000 (20:27 +0000)
committerRichard Stallman <rms@gnu.org>
Wed, 16 Jun 1993 20:27:18 +0000 (20:27 +0000)
Handle identifier_node as the TYPE_NAME.

From-SVN: r4682

gcc/c-typeck.c

index d7bd4ad521d656dbeaa7728635ab3d533d106247..a10fb0abcc3fcd31289dad802e8e9f7ae5ab08cc 100644 (file)
@@ -1794,12 +1794,18 @@ check_format (info, params)
   
          this = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (wanted_type)));
          that = 0;
-         if (TYPE_NAME (cur_type) != 0
+         if (TREE_CODE (cur_type) != ERROR_MARK
+             && TYPE_NAME (cur_type) != 0
              && TREE_CODE (cur_type) != INTEGER_TYPE
              && !(TREE_CODE (cur_type) == POINTER_TYPE
-                  && TREE_CODE (TREE_TYPE (cur_type)) == INTEGER_TYPE)
-             && DECL_NAME (TYPE_NAME (cur_type)) != 0)
-           that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (cur_type)));
+                  && TREE_CODE (TREE_TYPE (cur_type)) == INTEGER_TYPE))
+           {
+             if (TREE_CODE (TYPE_NAME (cur_type)) == TYPE_DECL
+                 && DECL_NAME (TYPE_NAME (cur_type)) != 0)
+               that = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (cur_type)));
+             else
+               that = IDENTIFIER_POINTER (TYPE_NAME (cur_type));
+           }
 
          /* A nameless type can't possibly match what the format wants.
             So there will be a warning for it.