From 2bdb7f56ff0290100875208f07bceb33e404e6e4 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 9 Jun 2015 08:06:17 +0000 Subject: [PATCH] re PR tree-optimization/66413 (ICE at -Os and above with -g enabled on x86_64-linux-gnu) 2015-06-09 Richard Biener PR middle-end/66413 * tree-inline.c (insert_init_debug_bind): Unshare value. * gcc.dg/torture/pr66413.c: New testcase. From-SVN: r224267 --- gcc/ChangeLog | 5 +++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/torture/pr66413.c | 61 ++++++++++++++++++++++++++ gcc/tree-inline.c | 2 +- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr66413.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a9554c516b5..6550f7c9bf3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-09 Richard Biener + + PR middle-end/66413 + * tree-inline.c (insert_init_debug_bind): Unshare value. + 2015-06-09 Richard Biener PR tree-optimization/66396 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e62eaba08ba..5c21d29fcd8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-09 Richard Biener + + PR middle-end/66413 + * gcc.dg/torture/pr66413.c: New testcase. + 2015-06-09 Alexandre Oliva * gcc.dg/guality/pr54200.c: Add -fno-tree-coalesce-vars. diff --git a/gcc/testsuite/gcc.dg/torture/pr66413.c b/gcc/testsuite/gcc.dg/torture/pr66413.c new file mode 100644 index 00000000000..0ca57d7202a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr66413.c @@ -0,0 +1,61 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-g" } */ + +int a, b, c, d, i, j, q, *e, *h, *k, *r, **p = &e; +const int *f, **n = &f; +static int g; + +void +fn1 (int p1) +{ + c = p1; +} + +static int * +fn2 (int *p1, const int *p2) +{ + if (g) + n = &p2; + *n = p2; + int o[245]; + fn1 (o != p2); + return p1; +} + +static int * +fn3 () +{ + int s[54], *t = &s[0], u = 0, v = 1; + h = &v; + q = 1; + for (; q; q++) + { + int *w[] = { &u }; + for (; v;) + return *p; + } + *r = *t + b >= 0; + return *p; +} + +static int +fn4 (int *p1) +{ + int *l[2], **m[7]; + for (; i < 1; i++) + for (; j < 1; j++) + m[i * 70] = &l[0]; + k = fn3 (); + fn2 (0, p1); + if ((m[0] == 0) & a) + for (;;) + ; + return 0; +} + +int +main () +{ + fn4 (&d); + return 0; +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 242026c86e4..1fa5dabb56a 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3021,7 +3021,7 @@ insert_init_debug_bind (copy_body_data *id, base_stmt = gsi_stmt (gsi); } - note = gimple_build_debug_bind (tracked_var, value, base_stmt); + note = gimple_build_debug_bind (tracked_var, unshare_expr (value), base_stmt); if (bb) { -- 2.30.2