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] Skip case struct-layout-1 for targets using short enums.


Hello,

There are some bitfield definitions in this case, such as "enum E2 a:31".
For most targets, the ENUM type size equals INT type so this definition is
OK. But for some targets like arm_eabi, the default ENUM type size could be
the smallest integer type that can contain all of its enumerated values. For
this case, the size of variable a is 8 bits. Thus the above definition is
regarded as an error.

We could fix this issue in two methods: compile the cases with option
-fno-short-enums or just skip the case for targets with short enums. For the
first one, the user must also provide a library built with option
-fno-short-enums, otherwise linking them together could cause subtle issues.
This patch prefers the last method. If the no-short-enums library is ready,
user can still run this case by performing "make check" with extra option
-fno-short-enums.

Here is the patch, is it OK to commit?

Best regards,
Terry

2011-08-31  Terry Guo  <terry.guo@arm.com>

        * gcc.dg/compat/struct-layout-1_main.c: Skip the case
        if the target uses short enums.

diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c
b/gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c
index b59453e..64275ea 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_main.c
@@ -1,4 +1,5 @@
 /* { dg-prune-output ".*-Wno-abi.*" } */
+/* { dg-skip-if "" { short_enums } } */
  
   #include "struct-layout-1.h"



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