From: Jakub Jelinek Date: Fri, 30 Aug 2019 12:20:12 +0000 (+0200) Subject: backport: re PR debug/89704 (ICE in add_const_value_attribute, at dwarf2out.c:19685) X-Git-Tag: releases/gcc-7.5.0~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59ab6dc89f8f0e76d3e9419aa11e1f26104e4ef0;p=thirdparty%2Fgcc.git backport: re PR debug/89704 (ICE in add_const_value_attribute, at dwarf2out.c:19685) Backported from mainline 2019-03-15 Jakub Jelinek 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 37e1a9fe8efc..e0b0736c9e2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-03-15 Jakub Jelinek + + PR debug/89704 + * dwarf2out.c (add_const_value_attribute): Return false for MINUS, + SIGN_EXTEND and ZERO_EXTEND. + 2019-03-14 Jakub Jelinek PR rtl-optimization/89679 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2069051cd0dc..a7f560872c0b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d9fdc68c19ef..7a134fcc4fac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-03-15 Jakub Jelinek + + PR debug/89704 + * gcc.dg/debug/pr89704.c: New test. + 2019-03-14 Jakub Jelinek 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 index 000000000000..4a8cf4fa4564 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr89704.c @@ -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; +}