aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Bosscher <stevenb@suse.de>2004-12-08 00:12:03 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2004-12-08 00:12:03 +0000
commit02fbae83425bb4036cc58963e05460af2e395585 (patch)
tree201a6333e6bc0735dfcd4a3615016230541afc32
parent665fcad835bb6ac9d2d41077bd74b8ba66ebfecc (diff)
downloadgcc-02fbae83425bb4036cc58963e05460af2e395585.zip
gcc-02fbae83425bb4036cc58963e05460af2e395585.tar.gz
gcc-02fbae83425bb4036cc58963e05460af2e395585.tar.bz2
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-typeck.c1
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/20041207.c8
4 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7542d68..70747e2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
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
* tree-ssa-pre.c (compute_antic): Fix comment.
(compute_avail): Do not recurse, instead do a DFS using a stack
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index f2f9b4d..e5c8ef5 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ea90773..440f309 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/gcc.dg/noncompile/20041207.c b/gcc/testsuite/gcc.dg/noncompile/20041207.c
new file mode 100644
index 0000000..7024245
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/20041207.c
@@ -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" } */
+}