diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-08-16 20:50:18 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-08-16 20:50:18 +0000 |
commit | c58e8676dd02e78d29512ff0f0b024ce91c62883 (patch) | |
tree | 2ec2140ed04b65b2da1c049493d675e61c629492 /gcc | |
parent | e8c96d09013bbef59b28613a4982bc499a1073a7 (diff) | |
download | gcc-c58e8676dd02e78d29512ff0f0b024ce91c62883.zip gcc-c58e8676dd02e78d29512ff0f0b024ce91c62883.tar.gz gcc-c58e8676dd02e78d29512ff0f0b024ce91c62883.tar.bz2 |
re PR c/27489 (ICE on broken switch condition)
PR c/27489
* c-typeck.c (c_start_case): Handle invalid orig_type correctly.
Clean up.
From-SVN: r116188
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-typeck.c | 17 |
2 files changed, 14 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 16644ae..aa17eb1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-08-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c/27489 + * c-typeck.c (c_start_case): Handle invalid orig_type correctly. + Clean up. + 2006-08-16 Mike Stump <mrs@apple.com> * doc/invoke.texi (-Wno-deprecated-declarations): Fixup use of pxref. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 0a5aae5..2fbd89f 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); } } |