From 9c349a39eb5b2466b60a0be488a0c55bbf7915b2 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Tue, 25 Mar 2008 20:19:58 -0700 Subject: [PATCH] re PR objc/29197 (ICE after error with array type with undefined variable) 2008-03-25 Andrew Pinski PR objc/29197 * objc-act.c (encode_type): Handle when type is error_mark_node. (objc_push_parm): Handle when the type of parm is error_mark_node. 2008-03-25 Andrew Pinski PR objc/29197 * objc.dg/method-20.m: New testcase. From-SVN: r133540 --- gcc/objc/ChangeLog | 6 ++++++ gcc/objc/objc-act.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/objc.dg/method-20.m | 8 ++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/objc.dg/method-20.m diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index b558eb6939e..7584ed19d96 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,9 @@ +2008-03-25 Andrew Pinski + + PR objc/29197 + * objc-act.c (encode_type): Handle when type is error_mark_node. + (objc_push_parm): Handle when the type of parm is error_mark_node. + 2008-03-25 Tom Tromey * Make-lang.in (objc_OBJS): New variable. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 576e5695b99..48bf974fb36 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -8075,6 +8075,9 @@ encode_type (tree type, int curtype, int format) enum tree_code code = TREE_CODE (type); char c; + if (type == error_mark_node) + return; + if (TYPE_READONLY (type)) obstack_1grow (&util_obstack, 'r'); @@ -8231,6 +8234,13 @@ static void objc_push_parm (tree parm) { bool relayout_needed = false; + + if (TREE_TYPE (parm) == error_mark_node) + { + objc_parmlist = chainon (objc_parmlist, parm); + return; + } + /* Decay arrays and functions into pointers. */ if (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 79c4693c6f5..8ba4e6e9dcc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-03-25 Andrew Pinski + + PR objc/29197 + * objc.dg/method-20.m: New testcase. + 2008-03-25 Richard Sandiford PR rtl-optimization/35232 diff --git a/gcc/testsuite/objc.dg/method-20.m b/gcc/testsuite/objc.dg/method-20.m new file mode 100644 index 00000000000..653e047281d --- /dev/null +++ b/gcc/testsuite/objc.dg/method-20.m @@ -0,0 +1,8 @@ +/* { dg-do compile } */ + +/* We used to crash after we found the type for int[m] was declared as invalid. */ +/* PR objc/29197 */ + +@ implementation NGActiveSocket ++ (void) socketPair:(int[m]) _pair {} /* { dg-error "" } */ +@end -- 2.30.2