[Committed] New bit-field testcases Part 3/N

Message ID CA+=Sn1mfL5+xF5-Hw6zv2zNUyE_i6it=UmgU4k1eRTKt=6wghg@mail.gmail.com
State New
Headers show
Series
  • [Committed] New bit-field testcases Part 3/N
Related show

Commit Message

Andrew Pinski Jan. 6, 2020, 1:08 a.m.
Hi,
  I found some more testcases that would cause an internal compiler
error while working on my bit-field lowering pass.  Since there was no
testcase already done, I thought it would be best if it was applied to
the trunk.

Thanks,
Andrew Pinski

testsuite/ChangeLog:
* 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.

Patch

Index: gcc.c-torture/compile/20200105-1.c
===================================================================
--- gcc.c-torture/compile/20200105-1.c	(nonexistent)
+++ gcc.c-torture/compile/20200105-1.c	(working copy)
@@ -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;
+}
Index: gcc.c-torture/compile/20200105-2.c
===================================================================
--- gcc.c-torture/compile/20200105-2.c	(nonexistent)
+++ gcc.c-torture/compile/20200105-2.c	(working copy)
@@ -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;
+}
Index: gcc.c-torture/compile/20200105-3.c
===================================================================
--- gcc.c-torture/compile/20200105-3.c	(nonexistent)
+++ gcc.c-torture/compile/20200105-3.c	(working copy)
@@ -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;
+}