From dc2a58daabf95cfac0dd346ff717902bdc6e3d93 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 27 Jun 2011 18:45:49 +0200 Subject: [PATCH] re PR debug/49544 (ICE in new_elt_loc_list) PR debug/49544 * cselib.c (promote_debug_loc): If cselib_preserve_constants and l has two DEBUG_INSN owned locs instead of just one, adjust the second location's setting_insn too. * gcc.dg/pr49544.c: New test. From-SVN: r175540 --- gcc/ChangeLog | 7 +++++++ gcc/cselib.c | 10 +++++++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr49544.c | 19 +++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr49544.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9d3823a1a46..14e023b1771 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-06-27 Jakub Jelinek + + PR debug/49544 + * cselib.c (promote_debug_loc): If cselib_preserve_constants + and l has two DEBUG_INSN owned locs instead of just one, adjust + the second location's setting_insn too. + 2011-06-27 Rainer Orth PR libmudflap/38738 diff --git a/gcc/cselib.c b/gcc/cselib.c index e575aff72fd..b96c0cd07ab 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -257,7 +257,15 @@ promote_debug_loc (struct elt_loc_list *l) { n_debug_values--; l->setting_insn = cselib_current_insn; - gcc_assert (!l->next || cselib_preserve_constants); + if (cselib_preserve_constants && l->next) + { + gcc_assert (l->next->setting_insn + && DEBUG_INSN_P (l->next->setting_insn) + && !l->next->next); + l->next->setting_insn = cselib_current_insn; + } + else + gcc_assert (!l->next); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7184340d002..2d026a041b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-06-27 Jakub Jelinek + + PR debug/49544 + * gcc.dg/pr49544.c: New test. + 2011-06-27 Richard Guenther PR tree-optimization/49394 diff --git a/gcc/testsuite/gcc.dg/pr49544.c b/gcc/testsuite/gcc.dg/pr49544.c new file mode 100644 index 00000000000..65498f4ddc0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr49544.c @@ -0,0 +1,19 @@ +/* PR debug/49544 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2" } */ + +int baz (int, int, void *); + +static inline __attribute__ ((always_inline)) long +foo (int x, int y, void *z) +{ + if (y < 0) + return baz (x, y, z); + return 0; +} + +long +bar (long x, long y, long z) +{ + return foo (x, y, (void *) z); +} -- 2.30.2