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]

[PATCH,testsuite] fix some struct-reorg tests on bare metal targets


On powerpc-none-eabi* (and any other target using the GDB simulator, I
think), the following tests fail:

FAIL: gcc.dg/struct/wo_prof_single_str_global.c execution test
FAIL: gcc.dg/struct/wo_prof_single_str_local.c execution test
FAIL: gcc.dg/struct/wo_prof_single_str_pointer.c execution test

The tests return "256" -- which happens to be equivalent to zero on
POSIX systems.  But the GDB simulator passes along the full return
value, and we get a FAIL.

Fixed by masking the return value.  Tested on powerpc-none-eabi.  OK to
commit?

-Nathan

2009-01-12  Mark Mitchell  <mark@codesourcery.com>

	* gcc.dg/struct/wo_prof_single_str_global.c: Mask return value.
	* gcc.dg/struct/wo_prof_single_str_local.c: Mask return value.
	* gcc.dg/struct/wo_prof_single_str_pointer.c: Mask return value.

Index: gcc.dg/struct/wo_prof_single_str_global.c
===================================================================
--- gcc.dg/struct/wo_prof_single_str_global.c	(revision 143306)
+++ gcc.dg/struct/wo_prof_single_str_global.c	(working copy)
@@ -24,8 +24,10 @@ main ()
   
   if (str.a != res)
     abort ();
-
-  return str.a;
+  
+  /* POSIX ignores all but the 8 low-order bits, but other
+     environments may not.  */
+  return (str.a & 255);
 }
 
 /*--------------------------------------------------------------------------*/
Index: gcc.dg/struct/wo_prof_single_str_local.c
===================================================================
--- gcc.dg/struct/wo_prof_single_str_local.c	(revision 143306)
+++ gcc.dg/struct/wo_prof_single_str_local.c	(working copy)
@@ -25,7 +25,9 @@ main ()
   if (str.a != res)
     abort ();
 
-  return str.a;
+  /* POSIX ignores all but the 8 low-order bits, but other
+     environments may not.  */
+  return (str.a & 255);
 }
 
 /*--------------------------------------------------------------------------*/
Index: gcc.dg/struct/wo_prof_single_str_pointer.c
===================================================================
--- gcc.dg/struct/wo_prof_single_str_pointer.c	(revision 143306)
+++ gcc.dg/struct/wo_prof_single_str_pointer.c	(working copy)
@@ -29,7 +29,9 @@ main ()
   if (p->a != res)
     abort ();
   
-  return p->a;
+  /* POSIX ignores all but the 8 low-order bits, but other
+     environments may not.  */
+  return (p->a & 255);
 }
 
 /*--------------------------------------------------------------------------*/


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