aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-12-19 13:16:56 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-12-19 13:16:56 +0100
commite90c56c6b2a90e0a0d1a97a0238da0b4cd5b563d (patch)
tree3e5bc702a707a5970dfee20b5b6e325902808a70
parentda942ca0e2814f1f7420e508e80d9939cf799390 (diff)
downloadgcc-e90c56c6b2a90e0a0d1a97a0238da0b4cd5b563d.zip
gcc-e90c56c6b2a90e0a0d1a97a0238da0b4cd5b563d.tar.gz
gcc-e90c56c6b2a90e0a0d1a97a0238da0b4cd5b563d.tar.bz2
re PR debug/55730 (ICE in mem_loc_descriptor, at dwarf2out.c:12725)
PR debug/55730 * dwarf2out.c (mem_loc_descriptor): Ignore CLOBBER. * valtrack.c (gen_lowpart_for_debug): New function. (propagate_for_debug): Temporarily set rtl_hooks.gen_lowpart_no_emit to gen_lowpart_for_debug. * gcc.dg/debug/pr55730.c: New test. From-SVN: r194607
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/dwarf2out.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr55730.c24
-rw-r--r--gcc/valtrack.c22
5 files changed, 60 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 694062f..34b5836 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2012-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/55730
+ * dwarf2out.c (mem_loc_descriptor): Ignore CLOBBER.
+ * valtrack.c (gen_lowpart_for_debug): New function.
+ (propagate_for_debug): Temporarily set rtl_hooks.gen_lowpart_no_emit
+ to gen_lowpart_for_debug.
+
2012-12-18 Jan Hubicka <jh@suse.cz>
PR tree-optimization/55683
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index a284eed..a865250 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -12714,6 +12714,7 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
case CONST_VECTOR:
case CONST_FIXED:
case CLRSB:
+ case CLOBBER:
/* If delegitimize_address couldn't do anything with the UNSPEC, we
can't express it in the debug info. This can happen e.g. with some
TLS UNSPECs. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0a8580c..81693bf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/55730
+ * gcc.dg/debug/pr55730.c: New test.
+
2012-12-18 Jan Hubicka <jh@suse.cz>
PR tree-optimization/55683
diff --git a/gcc/testsuite/gcc.dg/debug/pr55730.c b/gcc/testsuite/gcc.dg/debug/pr55730.c
new file mode 100644
index 0000000..073d83d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/pr55730.c
@@ -0,0 +1,24 @@
+/* PR debug/55730 */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+union U
+{
+ float f;
+ int i;
+};
+
+void
+foo (unsigned short *x, unsigned char y)
+{
+ unsigned char g;
+ union U u;
+ if (u.i < 0)
+ g = 0;
+ else
+ {
+ u.f = u.f * (255.0F / 256.0F) + 32768.0F;
+ g = (unsigned char) u.i;
+ }
+ *x = (g << 8) | y;
+}
diff --git a/gcc/valtrack.c b/gcc/valtrack.c
index 5eefabd..07ef125 100644
--- a/gcc/valtrack.c
+++ b/gcc/valtrack.c
@@ -29,6 +29,24 @@ along with GCC; see the file COPYING3. If not see
#include "regs.h"
#include "emit-rtl.h"
+/* gen_lowpart_no_emit hook implementation for DEBUG_INSNs. In DEBUG_INSNs,
+ all lowpart SUBREGs are valid, despite what the machine requires for
+ instructions. */
+
+static rtx
+gen_lowpart_for_debug (enum machine_mode mode, rtx x)
+{
+ rtx result = gen_lowpart_if_possible (mode, x);
+ if (result)
+ return result;
+
+ if (GET_MODE (x) != VOIDmode)
+ return gen_rtx_raw_SUBREG (mode, x,
+ subreg_lowpart_offset (mode, GET_MODE (x)));
+
+ return NULL_RTX;
+}
+
/* Replace auto-increment addressing modes with explicit operations to access
the same addresses without modifying the corresponding registers. */
@@ -158,6 +176,7 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src,
basic_block this_basic_block)
{
rtx next, loc, end = NEXT_INSN (BB_END (this_basic_block));
+ rtx (*saved_rtl_hook_no_emit) (enum machine_mode, rtx);
struct rtx_subst_pair p;
p.to = src;
@@ -165,6 +184,8 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src,
next = NEXT_INSN (insn);
last = NEXT_INSN (last);
+ saved_rtl_hook_no_emit = rtl_hooks.gen_lowpart_no_emit;
+ rtl_hooks.gen_lowpart_no_emit = gen_lowpart_for_debug;
while (next != last && next != end)
{
insn = next;
@@ -179,6 +200,7 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src,
df_insn_rescan (insn);
}
}
+ rtl_hooks.gen_lowpart_no_emit = saved_rtl_hook_no_emit;
}
/* Initialize DEBUG to an empty list, and clear USED, if given. */