OSDN Git Service

PR c++/10278
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Mar 2003 21:42:47 +0000 (21:42 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 31 Mar 2003 21:42:47 +0000 (21:42 +0000)
* c-common.c (finish_label_address_expr): Handle the
error_mark_node.

PR c++/10278
* g++.dg/parse/crash2.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65116 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash2.C [new file with mode: 0644]

index 3dcc8be..948815a 100644 (file)
@@ -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
index ee4549c..65322df 100644 (file)
@@ -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;
index f0b4bfd..ec6a418 100644 (file)
@@ -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 (file)
index 0000000..ccf89cc
--- /dev/null
@@ -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 "" } */
+}