]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/89704 (ICE in add_const_value_attribute, at dwarf2out.c:19685)
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 12:20:12 +0000 (14:20 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 12:20:12 +0000 (14:20 +0200)
Backported from mainline
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.

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

From-SVN: r275133

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

index 37e1a9fe8efc18d7904c6485cc10d71393d2187c..e0b0736c9e2c2e5af33c64c45d1971cd4a37acd5 100644 (file)
@@ -1,6 +1,12 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       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  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/89679
index 2069051cd0dcb2519c629aa3a23832d13df58b9c..a7f560872c0bb309607fbdc0243b01f24a61ad95 100644 (file)
@@ -18679,6 +18679,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 d9fdc68c19efa8414472d204f1eb9ea261753cbd..7a134fcc4fac861e2c61ed91a4f5b6ce1d0b0928 100644 (file)
@@ -1,6 +1,11 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-03-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/89704
+       * gcc.dg/debug/pr89704.c: New test.
+
        2019-03-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/89679
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;
+}