aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-06-16 20:27:18 +0000
committerRichard Stallman <rms@gnu.org>1993-06-16 20:27:18 +0000
commitd6272e453df01a14b586a1ca45fcb90aed2817c9 (patch)
tree239ffe6e71997aecef170d15c01d3cb242e806b0 /gcc
parent4ab08223d10ad425c2c984e9f1560fef7cf24eed (diff)
downloadgcc-d6272e453df01a14b586a1ca45fcb90aed2817c9.zip
gcc-d6272e453df01a14b586a1ca45fcb90aed2817c9.tar.gz
gcc-d6272e453df01a14b586a1ca45fcb90aed2817c9.tar.bz2
(check_format): Don't crash if cur_type is an error_mark.
Handle identifier_node as the TYPE_NAME. From-SVN: r4682
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index d7bd4ad..a10fb0a 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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.