Commit c58e8676 by Volker Reichelt Committed by Volker Reichelt

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
parent e8c96d09
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> 2006-08-16 Mike Stump <mrs@apple.com>
* doc/invoke.texi (-Wno-deprecated-declarations): Fixup use of pxref. * doc/invoke.texi (-Wno-deprecated-declarations): Fixup use of pxref.
......
...@@ -7064,25 +7064,25 @@ struct c_switch *c_switch_stack; ...@@ -7064,25 +7064,25 @@ struct c_switch *c_switch_stack;
tree tree
c_start_case (tree exp) c_start_case (tree exp)
{ {
enum tree_code code; tree orig_type = error_mark_node;
tree type, orig_type = error_mark_node;
struct c_switch *cs; struct c_switch *cs;
if (exp != error_mark_node) if (exp != error_mark_node)
{ {
code = TREE_CODE (TREE_TYPE (exp));
orig_type = TREE_TYPE (exp); orig_type = TREE_TYPE (exp);
if (!INTEGRAL_TYPE_P (orig_type) if (!INTEGRAL_TYPE_P (orig_type))
&& code != ERROR_MARK)
{ {
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; exp = integer_zero_node;
orig_type = error_mark_node;
} }
else else
{ {
type = TYPE_MAIN_VARIANT (TREE_TYPE (exp)); tree type = TYPE_MAIN_VARIANT (orig_type);
if (!in_system_header if (!in_system_header
&& (type == long_integer_type_node && (type == long_integer_type_node
...@@ -7091,7 +7091,6 @@ c_start_case (tree exp) ...@@ -7091,7 +7091,6 @@ c_start_case (tree exp)
"converted to %<int%> in ISO C"); "converted to %<int%> in ISO C");
exp = default_conversion (exp); exp = default_conversion (exp);
type = TREE_TYPE (exp);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment