]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/46893 (ICE: in trunc_int_for_mode, at explow.c:56 with -O -g)
authorJakub Jelinek <jakub@redhat.com>
Sun, 16 Jan 2011 20:20:21 +0000 (21:20 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 16 Jan 2011 20:20:21 +0000 (21:20 +0100)
Backport from mainline
2010-12-16  Jakub Jelinek  <jakub@redhat.com>

PR debug/46893
* cfgexpand.c (expand_debug_expr): If GET_MODE (op0) is VOIDmode,
use TYPE_MODE (TREE_TYPE (tem)) instead of mode1.

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

From-SVN: r168865

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr46893.c [new file with mode: 0644]

index 109c878484c416dd417d56000fdbd9335d71dbd1..d65bebc2019853b7e18bc22deac946f9bae944a9 100644 (file)
@@ -1,6 +1,12 @@
 2011-01-16  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2010-12-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/46893
+       * cfgexpand.c (expand_debug_expr): If GET_MODE (op0) is VOIDmode,
+       use TYPE_MODE (TREE_TYPE (tem)) instead of mode1.
+
        2010-12-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/46804
index 751bcd41c9e0d13ca8ea625556d07bf2cdd941e6..9cc0432fd9be4c49eb4ed2ff11863f9defcc0551 100644 (file)
@@ -2578,7 +2578,7 @@ expand_debug_expr (tree exp)
            enum machine_mode opmode = GET_MODE (op0);
 
            if (opmode == VOIDmode)
-             opmode = mode1;
+             opmode = TYPE_MODE (TREE_TYPE (tem));
 
            /* This condition may hold if we're expanding the address
               right past the end of an array that turned out not to
@@ -2599,7 +2599,8 @@ expand_debug_expr (tree exp)
                                     ? SIGN_EXTRACT
                                     : ZERO_EXTRACT, mode,
                                     GET_MODE (op0) != VOIDmode
-                                    ? GET_MODE (op0) : mode1,
+                                    ? GET_MODE (op0)
+                                    : TYPE_MODE (TREE_TYPE (tem)),
                                     op0, GEN_INT (bitsize), GEN_INT (bitpos));
       }
 
index 442f44631600fddde4983600c0cb9dbf2d2d73d0..fd8d27dc2a47f853c47b55b424a3678c40a8e861 100644 (file)
@@ -1,6 +1,11 @@
 2011-01-16  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2010-12-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/46893
+       * gcc.dg/pr46893.c: New test.
+
        2010-12-10  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/46804
diff --git a/gcc/testsuite/gcc.dg/pr46893.c b/gcc/testsuite/gcc.dg/pr46893.c
new file mode 100644 (file)
index 0000000..ef97e2e
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR debug/46893 */
+/* { dg-do compile } */
+/* { dg-options "-O -g" } */
+
+void
+foo (void)
+{
+  union { unsigned long long l; double d; } u = { 0x7ff0000000000000ULL };
+  double v = 0, w = -u.d;
+
+  if (w)
+    w = v;
+}