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
This commit is contained in:
Volker Reichelt 2006-08-16 20:50:18 +00:00 committed by Volker Reichelt
parent e8c96d0901
commit c58e8676dd
2 changed files with 14 additions and 9 deletions

View File

@ -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.

View File

@ -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);
}
}