aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c
new file mode 100644
index 000000000..6f7d7e25c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/bitfld-4.c
@@ -0,0 +1,21 @@
+/* When comparisons of bit-fields to unsigned constants got shortened,
+ the shortened signed constant was wrongly marked as overflowing,
+ leading to a later integer_zerop failure and misoptimization.
+
+ Related to bug tree-optimization/16437 but shows the problem on
+ 32-bit systems. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+
+extern void abort (void);
+
+struct s { int a:12, b:20; };
+
+struct s x = { -123, -456 };
+
+int
+main (void)
+{
+ if (x.a != -123U || x.b != -456U)
+ abort ();
+ return 0;
+}