re PR debug/89704 (ICE in add_const_value_attribute, at dwarf2out.c:19685)
authorJakub Jelinek <jakub@redhat.com>
Fri, 15 Mar 2019 08:00:46 +0000 (09:00 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 15 Mar 2019 08:00:46 +0000 (09:00 +0100)
PR debug/89704
* dwarf2out.c (add_const_value_attribute): Return false for MINUS,
SIGN_EXTEND and ZERO_EXTEND.

* gcc.dg/debug/pr89704.c: New test.

From-SVN: r269700

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

index 394271f8bc269713b1d2e6393119e2154f19d598..5bd943b27fe908d94c25f1197f4313e092dce6f4 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/89704
+       * dwarf2out.c (add_const_value_attribute): Return false for MINUS,
+       SIGN_EXTEND and ZERO_EXTEND.
+
 2019-03-14  Jason Merrill  <jason@redhat.com>
            Jakub Jelinek  <jakub@redhat.com>
 
index c9f1e31014c7574d9f4718e96cbe1d3d5d7431e5..d9cefd3e1d3cf139f5af40ba005855e0d83cfffd 100644 (file)
@@ -19670,6 +19670,9 @@ add_const_value_attribute (dw_die_ref die, rtx rtl)
 
     case HIGH:
     case CONST_FIXED:
+    case MINUS:
+    case SIGN_EXTEND:
+    case ZERO_EXTEND:
       return false;
 
     case MEM:
index 8f7288ed5b22cacf5240b3a5208b3794f8d0d843..8780192ddd2033ed2b9ccfaf826ebf559fc86432 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/89704
+       * gcc.dg/debug/pr89704.c: New test.
+
 2019-03-15  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/89650
diff --git a/gcc/testsuite/gcc.dg/debug/pr89704.c b/gcc/testsuite/gcc.dg/debug/pr89704.c
new file mode 100644 (file)
index 0000000..4a8cf4f
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR debug/89704 */
+/* { dg-do compile } */
+
+typedef __INTPTR_TYPE__ intptr_t;
+
+int
+foo (void)
+{
+  lab1:;
+  lab2:;
+  static int i = (intptr_t) &&lab1 - (intptr_t) &&lab2;
+  static int j = (intptr_t) &&lab1 - (intptr_t) &&lab2;
+  return i;
+}