aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/sra-1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/sra-1.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/sra-1.C29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/sra-1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/sra-1.C
new file mode 100644
index 000000000..e3e3918eb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/sra-1.C
@@ -0,0 +1,29 @@
+/* https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=223576 */
+
+/* SRA failed to canonicalize bit-field types, introducing type
+ mismatches. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+struct A
+{
+ int a:16;
+ /* These dummy bit-fields are here to prevent GCC 4.2+ from merging
+ the bit-field compares into a single word compare, which disables
+ SRA. */
+ int a2:16;
+ int a3:16;
+ int a4:16;
+ int b:8;
+ bool operator==(A const x) const
+ {
+ return (this->a == x.a && this->b == x.b);
+ }
+};
+
+bool
+foo (A const x, A const y)
+{
+ return x == y;
+}