This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix libjava/PR4766 failures on Solaris


FAIL: PR4766 compilation from source
FAIL: PR4766 -O3 compilation from source

The testcase generates an ICE in tree-eh.c because goto_queue_cmp is invoked 
on a NULL element.  The problem is that find_goto_replacement invokes bsearch

  ret = bsearch (&tmp, tf->goto_queue, tf->goto_queue_active,
		 sizeof (struct goto_queue_node), goto_queue_cmp);

on a NULL tf->goto_queue (with of course tf->goto_queue_active == 0).

This isn't problematic on Linux because bsearch is clever enough not to invoke 
the comparison function in that case, but is on Solaris.

Patch untested (except on libjava) because I'm not really sure where the 
early return should be placed.

2005-01-03  Eric Botcazou  <>

	* tree-eh.c (replace_goto_queue): Return early if the queue is empty.

Eric Botcazou
Index: tree-eh.c
RCS file: /cvs/gcc/gcc/gcc/tree-eh.c,v
retrieving revision 2.22
diff -u -p -r2.22 tree-eh.c
--- tree-eh.c	2 Dec 2004 15:56:29 -0000	2.22
+++ tree-eh.c	3 Jan 2005 13:19:07 -0000
@@ -443,6 +443,8 @@ replace_goto_queue_stmt_list (tree t, st
 static void
 replace_goto_queue (struct leh_tf_state *tf)
+  if (tf->goto_queue_active == 0)
+    return;
   replace_goto_queue_stmt_list (*tf->top_p, tf);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]