re PR debug/63342 (ICE in loc_list_from_tree, at dwarf2out.c:14698)
authorJakub Jelinek <jakub@redhat.com>
Wed, 1 Oct 2014 20:51:34 +0000 (22:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 1 Oct 2014 20:51:34 +0000 (22:51 +0200)
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.

From-SVN: r215782

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr63342.c [new file with mode: 0644]

index b87279f3c0f3d5c0173b9d5a016c7eaae1b75073..6a59825c0640337620f51760fcbe4fac258144fa 100644 (file)
@@ -1,5 +1,9 @@
 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.
+
        * config/i386/i386.c (expand_vec_perm_palignr): Handle
        256-bit vectors for TARGET_AVX2.
 
index b5fcfa430992c7ac0a05179a0aa84eebc6e9ea20..a64038c41a346f3a4c322f863c32f4c240d7222c 100644 (file)
@@ -14416,15 +14416,21 @@ loc_list_from_tree (tree loc, int want_address)
       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_address)
 
     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);
index 8f02f56b730778a1e62615711026c1d85565d349..9936e6192ecb4f6000a396663369efe8e90406b1 100644 (file)
@@ -1,5 +1,8 @@
 2014-10-01  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/63342
+       * gcc.dg/pr63342.c: New test.
+
        PR c++/63306
        * g++.dg/ipa/pr63306.C: New test.
 
diff --git a/gcc/testsuite/gcc.dg/pr63342.c b/gcc/testsuite/gcc.dg/pr63342.c
new file mode 100644 (file)
index 0000000..499d508
--- /dev/null
@@ -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;
+}