This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix dwarf2out ICE (PR debug/63342)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Oct 2014 22:39:27 +0200
- Subject: [PATCH] Fix dwarf2out ICE (PR debug/63342)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Since r214899 we ICE on the following testcase, because when
mem_loc_descriptor gives up on a complex TLS related address that
can't be (easily) delegitimized, we try to build location description
from MEM_EXPR, but in this case it is a TARGET_MEM_REF which wasn't handled.
I've implemented more complex handling of TARGET_MEM_REF (attached to the
PR), but we really can't handle SSA_NAMEs anyway, and I doubt there will
be any usable TARGET_MEM_REFs without SSA_NAMEs in them.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok except for the MEM_REF change for 4.9/4.8 (where the mem_loc_descriptor
fix also went)?
2014-10-01 Jakub Jelinek <jakub@redhat.com>
PR debug/63342
* dwarf2out.c (loc_list_from_tree): Handle MEM_REF with non-zero
offset, TARGET_MEM_REF and SSA_NAME.
* gcc.dg/pr63342.c: New test.
--- gcc/dwarf2out.c.jj 2014-09-25 10:10:26.000000000 +0200
+++ gcc/dwarf2out.c 2014-09-29 16:39:03.847184205 +0200
@@ -14416,15 +14416,21 @@ loc_list_from_tree (tree loc, int want_a
break;
case MEM_REF:
- /* ??? FIXME. */
if (!integer_zerop (TREE_OPERAND (loc, 1)))
- return 0;
+ {
+ have_address = 1;
+ goto do_plus;
+ }
/* Fallthru. */
case INDIRECT_REF:
list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
have_address = 1;
break;
+ case TARGET_MEM_REF:
+ case SSA_NAME:
+ return NULL;
+
case COMPOUND_EXPR:
return loc_list_from_tree (TREE_OPERAND (loc, 1), want_address);
@@ -14587,6 +14593,7 @@ loc_list_from_tree (tree loc, int want_a
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
+ do_plus:
if (tree_fits_shwi_p (TREE_OPERAND (loc, 1)))
{
list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
--- gcc/testsuite/gcc.dg/pr63342.c.jj 2014-09-29 17:02:09.217540570 +0200
+++ gcc/testsuite/gcc.dg/pr63342.c 2014-09-29 17:04:31.797832252 +0200
@@ -0,0 +1,26 @@
+/* PR debug/63342 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+/* { dg-additional-options "-fpic" { target fpic } } */
+
+static __thread double u[9], v[9];
+
+void
+foo (double **p, double **q)
+{
+ *p = u;
+ *q = v;
+}
+
+double
+bar (double x)
+{
+ int i;
+ double s = 0.0;
+ for (i = 0; i < 9; i++)
+ {
+ double a = x + v[i];
+ s += u[i] * a * a;
+ }
+ return s;
+}
Jakub