* [PATCH] Fix objc/29197: ICE after error with array type with undefined variable
@ 2008-03-24 12:01 Andrew Pinski
2008-03-26 6:21 ` Stan Shebs
0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2008-03-24 12:01 UTC (permalink / raw)
To: Gcc Patch List
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
Hi,
The problem here is that encode_type and objc_push_parm don't handle
error_mark_node that well. This fixes that problem by having them
handle it.
OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
Note I originally wrote this patch about a year and half ago and it
still solves the ICE.
Thanks,
Andrew Pinski
ChangeLog:
* 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.
* objc.dg/method-20.m: New testcase.
[-- Attachment #2: fixpr29197.diff.txt --]
[-- Type: text/plain, Size: 1192 bytes --]
Index: objc/objc-act.c
===================================================================
--- objc/objc-act.c (revision 133459)
+++ objc/objc-act.c (working copy)
@@ -8075,6 +8075,9 @@ encode_type (tree type, int curtype, int
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)
{
Index: testsuite/objc.dg/method-20.m
===================================================================
--- testsuite/objc.dg/method-20.m (revision 0)
+++ testsuite/objc.dg/method-20.m (revision 0)
@@ -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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix objc/29197: ICE after error with array type with undefined variable
2008-03-24 12:01 [PATCH] Fix objc/29197: ICE after error with array type with undefined variable Andrew Pinski
@ 2008-03-26 6:21 ` Stan Shebs
0 siblings, 0 replies; 2+ messages in thread
From: Stan Shebs @ 2008-03-26 6:21 UTC (permalink / raw)
To: Andrew Pinski; +Cc: Gcc Patch List
Andrew Pinski wrote:
> Hi,
> The problem here is that encode_type and objc_push_parm don't handle
> error_mark_node that well. This fixes that problem by having them
> handle it.
>
> OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
> Note I originally wrote this patch about a year and half ago and it
> still solves the ICE.
>
This is fine, thanks!
Stan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-25 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-24 12:01 [PATCH] Fix objc/29197: ICE after error with array type with undefined variable Andrew Pinski
2008-03-26 6:21 ` Stan Shebs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).