From 8f50e25f38c136f2cb73703efccbc175813d960c Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Mon, 6 Jan 2020 01:08:21 +0000 Subject: [PATCH] New bitfield testcases. 2020-01-05 Andrew Pinski * gcc.c-torture/compile/20200105-1.c: New testcase. * gcc.c-torture/compile/20200105-2.c: New testcase. * gcc.c-torture/compile/20200105-3.c: New testcase. From-SVN: r279893 --- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.c-torture/compile/20200105-1.c | 12 ++++++++++++ gcc/testsuite/gcc.c-torture/compile/20200105-2.c | 12 ++++++++++++ gcc/testsuite/gcc.c-torture/compile/20200105-3.c | 12 ++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/20200105-1.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20200105-2.c create mode 100644 gcc/testsuite/gcc.c-torture/compile/20200105-3.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 81ede35..01d4022 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-01-05 Andrew Pinski + + * gcc.c-torture/compile/20200105-1.c: New testcase. + * gcc.c-torture/compile/20200105-2.c: New testcase. + * gcc.c-torture/compile/20200105-3.c: New testcase. + 2020-01-05 Iain Sandoe * gcc.dg/darwin-version-1.c: Adjust test to use different diff --git a/gcc/testsuite/gcc.c-torture/compile/20200105-1.c b/gcc/testsuite/gcc.c-torture/compile/20200105-1.c new file mode 100644 index 0000000..8716b6a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20200105-1.c @@ -0,0 +1,12 @@ +struct mouse_button_str { + unsigned char left : 1; + unsigned char right : 1; + unsigned char middle : 1; + }; +int g(void) +{ + signed char a = 0; + struct mouse_button_str *newbutton1 = (struct mouse_button_str*)&a; + newbutton1->left = 1; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20200105-2.c b/gcc/testsuite/gcc.c-torture/compile/20200105-2.c new file mode 100644 index 0000000..5329411 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20200105-2.c @@ -0,0 +1,12 @@ +struct mouse_button_str { + signed char left : 1; + signed char right : 1; + signed char middle : 1; +}; +int g(void) +{ + unsigned char a = 0; + struct mouse_button_str *newbutton1 = (struct mouse_button_str*)&a; + newbutton1->left = 1; + return a; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20200105-3.c b/gcc/testsuite/gcc.c-torture/compile/20200105-3.c new file mode 100644 index 0000000..8b55171 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20200105-3.c @@ -0,0 +1,12 @@ +struct mouse_button_str { + unsigned char left : 1; + unsigned char right : 1; + unsigned char middle : 1; +}; +int g(void) +{ + unsigned char a = 0; + struct mouse_button_str *newbutton1 = (struct mouse_button_str*)&a; + newbutton1->left = 1; + return a; +} -- 2.7.4