diff mbox series

[Committed] Two new bit-field compile testcases

Message ID CA+=Sn1ngDwzuQ9AGPqtgwWUrdxbRhzS=H6Yr4BenC8NoThCR_w@mail.gmail.com
State New
Headers show
Series [Committed] Two new bit-field compile testcases | expand

Commit Message

Andrew Pinski Oct. 15, 2019, 9:05 p.m. UTC
Hi all,
  While working on implementing lowering of bit-field accesses in
gimple, I ran into an ICE which was not covered by the current
testsuite.

Committed these two new testcases as obvious.

Thanks,
Andrew Pinski

ChangeLog:
* gcc.c-torture/compile/20191015-1.c: New test.
* gcc.c-torture/compile/20191015-2.c: New test.
diff mbox series

Patch

Index: gcc/testsuite/gcc.c-torture/compile/20191015-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/20191015-1.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/compile/20191015-1.c	(working copy)
@@ -0,0 +1,17 @@ 
+typedef unsigned uint32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef struct {
+ uint32_t mbxOwner:1;
+ uint32_t mbxHc:1;
+ uint32_t mbxReserved:6;
+ uint32_t mbxCommand : 8;
+ uint32_t mbxStatus : 16;
+} MAILBOX_t;
+uint32_t f(void) {
+       uint32_t mbox;
+ mbox = 0;
+ ((MAILBOX_t *)&mbox)->mbxCommand = 0x24;
+ ((MAILBOX_t *)&mbox)->mbxOwner = 1;
+return mbox;
+}
Index: gcc/testsuite/gcc.c-torture/compile/20191015-2.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/20191015-2.c	(nonexistent)
+++ gcc/testsuite/gcc.c-torture/compile/20191015-2.c	(working copy)
@@ -0,0 +1,17 @@ 
+typedef unsigned uint32_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef struct {
+ uint8_t mbxOwner:1;
+ uint8_t mbxHc:1;
+ uint8_t mbxReserved:6;
+ uint8_t mbxCommand : 8;
+ uint16_t mbxStatus : 16;
+} MAILBOX_t;
+uint32_t f(void) {
+       uint32_t mbox;
+ mbox = 0;
+ ((MAILBOX_t *)&mbox)->mbxCommand = 0x24;
+ ((MAILBOX_t *)&mbox)->mbxOwner = 1;
+return mbox;
+}