]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/42475 (ICE at -O1 and above: internal compiler error: in simpl...
authorJakub Jelinek <jakub@redhat.com>
Wed, 23 Dec 2009 17:04:07 +0000 (18:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 23 Dec 2009 17:04:07 +0000 (18:04 +0100)
PR rtl-optimization/42475
* combine.c (make_compound_operation) <case SUBREG>: Use mode of
SUBREG_REG (x) instead of tem's mode.

* gcc.dg/pr42475.c: New test.

From-SVN: r155430

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr42475.c [new file with mode: 0644]

index 42c4e1c085cf48ebc166a0be86f3aa5978fa8d32..f60a33cf5b455331791c013a6241b721a1add4ce 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/42475
+       * combine.c (make_compound_operation) <case SUBREG>: Use mode of
+       SUBREG_REG (x) instead of tem's mode.
+
 2009-12-23  Jakub Jelinek  <jakub@redhat.com>
            Cary Coutant  <ccoutant@google.com>
 
index 2c60ae5640fb8c58090e26feaf71376e049c7bf6..5ae557c180aff43d97ad8774d5bc6db2b6a3d4da 100644 (file)
@@ -7306,15 +7306,14 @@ make_compound_operation (rtx x, enum rtx_code in_code)
       tem = make_compound_operation (SUBREG_REG (x), in_code);
 
       {
-       rtx simplified;
-       simplified = simplify_subreg (GET_MODE (x), tem, GET_MODE (tem),
-                                     SUBREG_BYTE (x));
+       rtx simplified = simplify_subreg (mode, tem, GET_MODE (SUBREG_REG (x)),
+                                         SUBREG_BYTE (x));
 
        if (simplified)
          tem = simplified;
 
        if (GET_CODE (tem) != GET_CODE (SUBREG_REG (x))
-           && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (tem))
+           && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
            && subreg_lowpart_p (x))
          {
            rtx newer = force_to_mode (tem, mode, ~(HOST_WIDE_INT) 0,
index 83144a258f2e9219ae094e9c890064175b208a20..98d85f4465f9a5c2e89fb4bdadac2efb0759db60 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/42475
+       * gcc.dg/pr42475.c: New test.
+
 2009-12-23  Jakub Jelinek  <jakub@redhat.com>
            Cary Coutant  <ccoutant@google.com>
 
diff --git a/gcc/testsuite/gcc.dg/pr42475.c b/gcc/testsuite/gcc.dg/pr42475.c
new file mode 100644 (file)
index 0000000..a5edffa
--- /dev/null
@@ -0,0 +1,28 @@
+/* PR rtl-optimization/42475 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef struct { float x, y; } B;
+typedef struct { float z; } C;
+typedef struct { B b; C c; } D;
+
+B
+foo (float x, float y)
+{
+  B b = { .x = x, .y = y };
+  return b;
+}
+
+B
+bar (B b, B y)
+{
+  return foo (y.x + b.x, b.y);
+}
+
+B
+baz (D p)
+{
+  D d = { };
+  B y = bar (foo (0, (p.c.z) / 2), d.b);
+  return y;
+}