From 8eb2215d8dc2662c3edad179b842097e0dce2722 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 15 Mar 2019 09:00:46 +0100 Subject: [PATCH] re PR debug/89704 (ICE in add_const_value_attribute, at dwarf2out.c:19685) 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 | 6 ++++++ gcc/dwarf2out.c | 3 +++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/debug/pr89704.c | 14 ++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/debug/pr89704.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 394271f8bc2..5bd943b27fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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 Jason Merrill Jakub Jelinek diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index c9f1e31014c..d9cefd3e1d3 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8f7288ed5b2..8780192ddd2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-15 Jakub Jelinek + + PR debug/89704 + * gcc.dg/debug/pr89704.c: New test. + 2019-03-15 H.J. Lu 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 index 00000000000..4a8cf4fa456 --- /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; +} -- 2.30.2