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] Fix gcc.dg/compare1.c failure on ARM. (Take 3)


Hi,

Attached is a revised patch to fix the failure of gcc.dg/compare1.c.

Previous versions of this patch are

http://gcc.gnu.org/ml/gcc-patches/2005-06/msg01899.html
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00129.html

Per Gaby's comment, I changed compare1.c so that we would skip the
test on arm*-*-eabi* arm*-*-symbianelf*.  (I chose dg-skip-if rather
than XFAIL because compare1.c assumes that enums have the same size as
int.  Thus the test is not applicable to these two ARM targets.)  I
then duplicated compare1.c as compare9.c and added -fno-short-enums
there.

Tested on x86_64-pc-linux-gnu and cross to arm-none-eabi.  Committed
as preapproved.

Kazu Hirata

2005-07-04  Kazu Hirata  <kazu@codesourcery.com>

	* gcc.dg/compare1.c: Skip on arm*-*-eabi* arm*-*-symbianelf*.
	* gcc.dg/compare9.c: New.

Index: testsuite/gcc.dg/compare1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compare1.c,v
retrieving revision 1.3
diff -u -d -p -r1.3 compare1.c
--- testsuite/gcc.dg/compare1.c	5 Jan 2000 19:26:23 -0000	1.3
+++ testsuite/gcc.dg/compare1.c	3 Jul 2005 21:33:24 -0000
@@ -3,7 +3,10 @@
 
 /* { dg-do compile } */
 /* { dg-options "-Wsign-compare" } */
+/* This test would fail on targets with short enums being default.  See
+   compare9.c.  */
+/* { dg-skip-if "" { arm*-*-eabi* arm*-*-symbianelf* }  { "*" } { "" } } */
 
 int tf = 1;
 
--- /dev/null	2004-06-24 11:05:26.000000000 -0700
+++ testsuite/gcc.dg/compare9.c	2005-07-03 14:32:51.000000000 -0700
@@ -0,0 +1,42 @@
+/* Test for a bogus warning on comparison between signed and unsigned.
+   This was inspired by code in gcc.  This testcase is identical to
+   compare1.c except that we add -fno-short-enums to accomodate
+   targets with short enums being default, such as arm*-*-eabi* and
+   arm*-*-symbianelf*.  */
+
+/* { dg-do compile } */
+/* { dg-options "-fno-short-enums -Wsign-compare" } */
+
+int tf = 1;
+
+/* This enumeration has an explicit negative value and is therefore signed.  */
+enum mm1 
+{
+  VOID, SI, DI, MAX = -1
+};
+
+/* This enumeration fits entirely in a signed int, but is unsigned anyway.  */
+enum mm2
+{
+  VOID2, SI2, DI2, MAX2
+};
+
+int f(enum mm1 x)
+{
+  return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
+}
+
+int g(enum mm1 x)
+{
+  return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
+}
+
+int h(enum mm2 x)
+{
+  return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
+}
+
+int i(enum mm2 x)
+{
+  return x == (tf?DI2:-1); /* { dg-warning "signed and unsigned" "case 4" } */
+}


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