2012-12-21 Martin Jambor <mjambor@suse.cz>
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Dec 2012 22:06:38 +0000 (22:06 +0000)
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Dec 2012 22:06:38 +0000 (22:06 +0000)
PR tree-optimization/55355
* tree-sra.c (type_internals_preclude_sra_p): Also check that
bit_position is small enough to fit a single HOST_WIDE_INT.

* testsuite/g++.dg/torture/pr55355.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194682 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr55355.C [new file with mode: 0644]
gcc/tree-sra.c

index 21af147..8bc25ed 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-21  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/55355
+       * tree-sra.c (type_internals_preclude_sra_p): Also check that
+       bit_position is small enough to fit a single HOST_WIDE_INT.
+
 2012-12-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * rtlanal.c (volatile_insn_p): Delete commented out code.
index cfbece0..3fa83c2 100644 (file)
@@ -1,3 +1,8 @@
+2012-12-21  Martin Jambor  <mjambor@suse.cz>
+
+       PR tree-optimization/55355
+       * g++.dg/torture/pr55355.C: New test.
+
 2012-12-21  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR middle-end/55775
diff --git a/gcc/testsuite/g++.dg/torture/pr55355.C b/gcc/testsuite/g++.dg/torture/pr55355.C
new file mode 100644 (file)
index 0000000..6d8f8b6
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+struct A
+{
+    void funcA(void);
+};
+
+struct B {};
+
+struct C
+{
+    void funcC(void) { a_mp->funcA(); }
+
+    char buf_ma[268435456];
+    A   *a_mp;
+    B    b_m;
+};
+
+void
+func(C *c_p)
+{
+    c_p->funcC();
+}
index 21d8a51..286ef26 100644 (file)
@@ -714,7 +714,12 @@ type_internals_preclude_sra_p (tree type, const char **msg)
              {
                *msg = "structure field size not fixed";
                return true;
-             }       
+             }
+           if (!host_integerp (bit_position (fld), 0))
+             {
+               *msg = "structure field size too big";
+               return true;
+             }
            if (AGGREGATE_TYPE_P (ft)
                    && int_bit_position (fld) % BITS_PER_UNIT != 0)
              {