This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Commit: XStormy16: Fix xstormy16_init_builtins()


Hi Guys,

  I am checking in the patch below to fix a couple of bugs in the
  xstormy16_init_builtins function.  The first was that the code was
  initialising the args[2] array element, which does not exist.  The
  second was that the arguments are constructed in the "args" array, but
  the build_function_type_list was being past bogus values from the
  "arg" array.

Cheers
  Nick

gcc/ChangeLog
2011-05-22  Nick Clifton  <nickc@redhat.com>

	* config/stormy16/stormy16.c (xstormy16_init_builtins): prevent
	initialisation of non-existent args[2] element.  Use args[] array
	not arg[] array to pass arguments to build_function_type_list.

Index: gcc/config/stormy16/stormy16.c
===================================================================
--- gcc/config/stormy16/stormy16.c	(revision 174027)
+++ gcc/config/stormy16/stormy16.c	(working copy)
@@ -2266,7 +2266,7 @@
 
       gcc_assert (n_args <= (int) ARRAY_SIZE (args));
 
-      for (a = n_args; a >= 0; a--)
+      for (a = n_args - 1; a >= 0; a--)
 	args[a] = NULL_TREE;
 
       for (a = n_args; a >= 0; a--)
@@ -2284,9 +2284,9 @@
 	  else
 	    args[a-1] = arg;
 	}
-      ftype = build_function_type_list (ret_type, arg[0], arg[1], NULL_TREE);
+      ftype = build_function_type_list (ret_type, args[0], args[1], NULL_TREE);
       add_builtin_function (s16builtins[i].name, ftype,
-			    i, BUILT_IN_MD, NULL, NULL);
+			    i, BUILT_IN_MD, NULL, NULL_TREE);
     }
 }
 


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