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]

Re: [VxWorks] Fix builtins tests


Richard Sandiford wrote:

gcc/testsuite/
	* gcc.c-torture/execute/builtins/memmove-lib.c: Include lib/bzero.c
	and lib/bfill.c on VxWorks targets.
	* gcc.c-torture/execute/builtins/memmove-2-lib.c: Likewise.
	* gcc.c-torture/execute/builtins/strchr-lib.c: Include lib/bzero.c,
	lib/bfill.c and lib/memmove.c on VxWorks targets.
	* gcc.c-torture/execute/builtins/strrchr-lib.c: Likewise.
	* gcc.c-torture/execute/builtins/memops-asm-lib.c: Include lib/bfill.c
	on VxWorks targets.
	* gcc.c-torture/execute/builtins/lib/bzero.c: New file.
	* gcc.c-torture/execute/builtins/lib/bfill.c: Likewise.

ok by me, with a minor change ...



Index: gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c

+bzero (void *s, __SIZE_TYPE__ n)
+{
+  char *p;
+
+#ifdef __OPTIMIZE__
+  if (inside_main)
+    abort ();
+#endif
+
+  for (p = s; n-- > 0; p++)
+    *p = 0;
+}

The inside_main check should be after the actual initialization. Some crt's use memset/bzero to initialize bss, and inside_main might be placed in bss. (see memset.c in the same directory).


Index: gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c

+void
+bfill (void *s, __SIZE_TYPE__ n, int ch)
+{
+  char *p;
+
+#ifdef __OPTIMIZE__
+  if (inside_main)
+    abort ();
+#endif
+
+  for (p = s; n-- > 0; p++)
+    *p = ch;
+}

Likewise.


I'm not sure you need Janis's approval too. Wait 24 hours to see if she spots something I missed.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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