re PR c/18867 (ICE on invalid switch quantity)

PR c/18867
        * c-typeck.c (c_start_case): Set orig_type to error_mark_node
        when the type of the controlling expression is not a valid type.

testsuite/
        * gcc.dg/noncompile/20041207.c: New test.

From-SVN: r91837
This commit is contained in:
Steven Bosscher 2004-12-08 00:12:03 +00:00 committed by Steven Bosscher
parent 665fcad835
commit 02fbae8342
4 changed files with 19 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2004-12-07 Steven Bosscher <stevenb@suse.de>
PR c/18867
* c-typeck.c (c_start_case): Set orig_type to error_mark_node
when the type of the controlling expression is not a valid type.
2004-12-07 Steven Bosscher <stevenb@suse.de>
PR tree-optimization/17340

View file

@ -6507,6 +6507,7 @@ c_start_case (tree exp)
{
error ("switch quantity not an integer");
exp = integer_zero_node;
orig_type = error_mark_node;
}
else
{

View file

@ -1,3 +1,7 @@
2004-12-07 Steven Bosscher <stevenb@suse.de>
* gcc.dg/noncompile/20041207.c: New test.
2004-12-07 Volker Reichelt <reichelt@gcc.gnu.org>
* g++.dg/other/unreachable-1.C: New test.

View file

@ -0,0 +1,8 @@
/* PR18867 - ICE on a switch controlling expressions with an
invalid type. Origin: Serge Belyshev <belyshev@lubercy.com> */
void f()
{
float x;
switch (x) {case 0: break;}; /* {dg-error "not an integer" } */
}