aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2003-03-31 21:42:47 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-03-31 21:42:47 +0000
commit6b6652197a4e4ee17855e36f38a479896264eed2 (patch)
treedf6ff0b2f4e9cd952fe75ebdf0a15786e610c11f
parentb174e2d4cca9f4d629f563e4d0fec90606969deb (diff)
downloadgcc-6b6652197a4e4ee17855e36f38a479896264eed2.zip
gcc-6b6652197a4e4ee17855e36f38a479896264eed2.tar.gz
gcc-6b6652197a4e4ee17855e36f38a479896264eed2.tar.bz2
re PR c++/10278 (ICE in parser)
PR c++/10278 * c-common.c (finish_label_address_expr): Handle the error_mark_node. PR c++/10278 * g++.dg/parse/crash2.C: New test. From-SVN: r65116
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-common.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/crash2.C7
4 files changed, 23 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3dcc8be..948815a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-03-31 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10278
+ * c-common.c (finish_label_address_expr): Handle the
+ error_mark_node.
+
2003-03-31 Richard Henderson <rth@redhat.com>
* real.c (real_identical): Reorg so as to not compare
diff --git a/gcc/c-common.c b/gcc/c-common.c
index ee4549c..65322df 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4212,8 +4212,8 @@ c_add_case_label (cases, cond, low_value, high_value)
return case_label;
}
-/* Finish an expression taking the address of LABEL. Returns an
- expression for the address. */
+/* Finish an expression taking the address of LABEL (an
+ IDENTIFIER_NODE). Returns an expression for the address. */
tree
finish_label_address_expr (label)
@@ -4229,6 +4229,9 @@ finish_label_address_expr (label)
pedwarn ("ISO C forbids taking the address of a label");
}
+ if (label == error_mark_node)
+ return error_mark_node;
+
label = lookup_label (label);
if (label == NULL_TREE)
result = null_pointer_node;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f0b4bfd..ec6a418 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-31 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/10278
+ * g++.dg/parse/crash2.C: New test.
+
2003-03-31 Richard Sandiford <rsandifo@redhat.com>
* gcc.c-torture/compile/20030331-1.c: New test, moved from...
diff --git a/gcc/testsuite/g++.dg/parse/crash2.C b/gcc/testsuite/g++.dg/parse/crash2.C
new file mode 100644
index 0000000..ccf89cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash2.C
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+int main(void)
+{
+ char x, y;
+ if ('A' == x) && ('B' == y)) { } /* { dg-error "" } */
+ if (x == 'A') && (y == 'B')) { } /* { dg-error "" } */
+}