aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-12-23 18:04:07 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-12-23 18:04:07 +0100
commit7f7211fb3fafede9ca157d5bceb3e7a0bc9cc74b (patch)
treef98113a149d7e5bfc953898164d3d9844ea58714
parent374b9cb810f4c44bd7e66078694dcbeb3d4b40cd (diff)
downloadgcc-7f7211fb3fafede9ca157d5bceb3e7a0bc9cc74b.zip
gcc-7f7211fb3fafede9ca157d5bceb3e7a0bc9cc74b.tar.gz
gcc-7f7211fb3fafede9ca157d5bceb3e7a0bc9cc74b.tar.bz2
re PR rtl-optimization/42475 (ICE at -O1 and above: internal compiler error: in simplify_subreg, at simplify-rtx.c:4954)
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/combine.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr42475.c28
4 files changed, 42 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 42c4e1c..f60a33c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,4 +1,10 @@
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>
PR debug/42454
diff --git a/gcc/combine.c b/gcc/combine.c
index 2c60ae5..5ae557c 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 83144a2..98d85f4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,4 +1,9 @@
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>
PR debug/42454
diff --git a/gcc/testsuite/gcc.dg/pr42475.c b/gcc/testsuite/gcc.dg/pr42475.c
new file mode 100644
index 0000000..a5edffa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr42475.c
@@ -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;
+}