diff mbox

[testsuite] Fix oversized bitfield warning.

Message ID 54B64ADF.5090901@arm.com
State New
Headers show

Commit Message

Matthew Wahab Jan. 14, 2015, 10:54 a.m. UTC
Hello,

Test case g++.dg/torture/20141013.C (added 
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01190.html) triggers the 
warning
--
   20141013.C:45:23: warning: width of 'tree_base::code' exceeds its type
--
on arm-none-eabi.

The code specifies a bitfield of size 16 with an enum as the underlying 
type. On arm-none-eabi, enums are packed by default (-fshort-enums) so 
the bitfield is oversized and the warning is correct.

This patch adds -fno-short-enums to the compiler options for the test case.

Testing: Ran g++.dg/torture/dg-torture.exp for arm-none-eabi and 
arm-none-linux-gnueabihf.

Matthew

2015-01-13  Matthew Wahab  <matthew.wahab@arm.com>

         * testsuite/g++.dg/torture/20141013.C: Set -fno-short-enums.

Comments

Jeff Law Jan. 14, 2015, 9:42 p.m. UTC | #1
On 01/14/15 03:54, Matthew Wahab wrote:
> Hello,
>
> Test case g++.dg/torture/20141013.C (added
> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01190.html) triggers the
> warning
> --
>    20141013.C:45:23: warning: width of 'tree_base::code' exceeds its type
> --
> on arm-none-eabi.
>
> The code specifies a bitfield of size 16 with an enum as the underlying
> type. On arm-none-eabi, enums are packed by default (-fshort-enums) so
> the bitfield is oversized and the warning is correct.
>
> This patch adds -fno-short-enums to the compiler options for the test case.
>
> Testing: Ran g++.dg/torture/dg-torture.exp for arm-none-eabi and
> arm-none-linux-gnueabihf.
>
> Matthew
>
> 2015-01-13  Matthew Wahab  <matthew.wahab@arm.com>
>
>          * testsuite/g++.dg/torture/20141013.C: Set -fno-short-enums.
OK for the trunk.  Please install.

Thanks,
Jeff
diff mbox

Patch

diff --git a/gcc/testsuite/g++.dg/torture/20141013.C b/gcc/testsuite/g++.dg/torture/20141013.C
index 529ef0965e4472e5038a9e6d09f13ca4f4a05954..82aacd6317eb3cd66b2839347a708ae0f4787efc 100644
--- a/gcc/testsuite/g++.dg/torture/20141013.C
+++ b/gcc/testsuite/g++.dg/torture/20141013.C
@@ -1,3 +1,4 @@ 
+/* { dg-options "-fno-short-enums" } */
 enum
 {
   _sch_isdigit = 0x0004,