summaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
authorreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-16 20:50:18 +0000
committerreichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-16 20:50:18 +0000
commit55d7e60b069ce28f1a85c46045d57b917ae0ddea (patch)
tree2ec2140ed04b65b2da1c049493d675e61c629492 /gcc/c-typeck.c
parent5eec57e0eb80c6ecaa28328422c56ada5b134f9d (diff)
downloadgcc-55d7e60b069ce28f1a85c46045d57b917ae0ddea.tar.gz
PR c/27489
* c-typeck.c (c_start_case): Handle invalid orig_type correctly. Clean up. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116188 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 0a5aae5eb37..2fbd89f5c2d 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -7064,25 +7064,25 @@ struct c_switch *c_switch_stack;
tree
c_start_case (tree exp)
{
- enum tree_code code;
- tree type, orig_type = error_mark_node;
+ tree orig_type = error_mark_node;
struct c_switch *cs;
if (exp != error_mark_node)
{
- code = TREE_CODE (TREE_TYPE (exp));
orig_type = TREE_TYPE (exp);
- if (!INTEGRAL_TYPE_P (orig_type)
- && code != ERROR_MARK)
+ if (!INTEGRAL_TYPE_P (orig_type))
{
- error ("switch quantity not an integer");
+ if (orig_type != error_mark_node)
+ {
+ error ("switch quantity not an integer");
+ orig_type = error_mark_node;
+ }
exp = integer_zero_node;
- orig_type = error_mark_node;
}
else
{
- type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
+ tree type = TYPE_MAIN_VARIANT (orig_type);
if (!in_system_header
&& (type == long_integer_type_node
@@ -7091,7 +7091,6 @@ c_start_case (tree exp)
"converted to %<int%> in ISO C");
exp = default_conversion (exp);
- type = TREE_TYPE (exp);
}
}