Patchwork [java] : Avoid looping over the end_params_node in put_decl_node

login
register
mail settings
Submitter Kai Tietz
Date March 22, 2013, 8:13 a.m.
Message ID <CAEwic4YxoyB8-Mm5gZGLQ=iG05TNyprRtZ_BWDW4sVv9SUD_Yw@mail.gmail.com>
Download mbox | patch
Permalink /patch/229903/
State New
Headers show

Comments

Kai Tietz - March 22, 2013, 8:13 a.m.
Hi,

this patch makes sure we don't walk in put_decl_node of the
end_params_node element.

ChangeLog

2013-03-22  Kai Tietz  <ktietz@redhat.com>

        * lang.c (put_decl_node): Don't iterate over end_params_node.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
x86_64-unknown-linux-gnu.  Ok for apply?

Regards,
Kai
Andrew Haley - March 22, 2013, 9:16 a.m.
On 03/22/2013 08:13 AM, Kai Tietz wrote:
> Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
> x86_64-unknown-linux-gnu.  Ok for apply?

Yes, thanks.

Andrew.

Patch

Index: gcc/java/lang.c
===================================================================
--- gcc/java/lang.c	(Revision 196898)
+++ gcc/java/lang.c	(Arbeitskopie)
@@ -419,7 +419,8 @@  put_decl_node (tree node, int verbosity)
 	      if (TREE_CODE (TREE_TYPE (node)) == METHOD_TYPE)
 		args = TREE_CHAIN (args);
 	      put_decl_string ("(", 1);
-	      for ( ; args != end_params_node;  args = TREE_CHAIN (args), i++)
+	      for ( ; args != NULL_TREE && args != end_params_node;
+		   args = TREE_CHAIN (args), i++)
 		{
 		  if (i > 0)
 		    put_decl_string (",", 1);