diff mbox

[testsuite] Fix another short-enums testsuite error

Message ID 000001cbb3f8$8351ab60$89f50220$@bolton@arm.com
State New
Headers show

Commit Message

Ian Bolton Jan. 14, 2011, 2:37 p.m. UTC
The following test case was failing bare-metal on ARM, but
working on Linux:

  gcc.dg/20100906-1.c

The fix was to make it compile with -fno-short-enums, as the
test implicitly requires this (it's the default on Linux), but it
needs to be explicitly requested on "short_enums" targets.

Note that this change leads to a linker warning due to a
subsequent mismatch between variable-size enums for the file and
32-bit enums (for the gcc_tg.o "testglue" file), so I have also
added a filter on this warning.

The fixed test now passes bare-metal (and Linux).

OK for trunk?

Cheers,
Ian


2011-01-14  Ian Bolton  <ian.bolton@arm.com>

	* testsuite/gcc.dg/20100906-1.c: Use -fno-short-enums
	option for "target short_enums", filter linker warning.

Comments

Joseph Myers Jan. 14, 2011, 5:27 p.m. UTC | #1
On Fri, 14 Jan 2011, Ian Bolton wrote:

> Note that this change leads to a linker warning due to a
> subsequent mismatch between variable-size enums for the file and
> 32-bit enums (for the gcc_tg.o "testglue" file), so I have also
> added a filter on this warning.

The normal approach for the warning would be to pass 
-Wl,--no-enum-size-warning on ARM eabi targets (or at least, that's the 
approach for tests passing -fshort-enums explicitly).

(I don't know if gold uses the same message text as GNU ld for this 
warning, but using the option avoids such dependence on details of the 
text from a tool outside of GCC.  You can presume gold has the same 
options, but not necessarily the same diagnostic text.)
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/20100906-1.c
===================================================================
--- gcc/testsuite/gcc.dg/20100906-1.c   (revision 168543)
+++ gcc/testsuite/gcc.dg/20100906-1.c   (working copy)
@@ -1,5 +1,6 @@ 
 /* { dg-do run } */
 /* { dg-options "-O2" } */
+/* { dg-options "-O2 -fno-short-enums" {target short_enums} } */
+/* { dg-prune-output "yet the output is to use variable-size enums" } */
 
 /* This testcase got misoptimized by combine due to a wrong setting of
    subst_low_luid in try_combine.  */