From: Richard Biener Date: Tue, 8 Jul 2014 09:04:29 +0000 (+0000) Subject: re PR tree-optimization/61681 (wrong code at -Os and above on x86_64-linux-gnu) X-Git-Tag: releases/gcc-5.1.0~6461 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8e938e0b0e92d28978d513e380be54640fdf94e;p=thirdparty%2Fgcc.git re PR tree-optimization/61681 (wrong code at -Os and above on x86_64-linux-gnu) 2014-07-08 Richard Biener PR tree-optimization/61681 * tree-ssa-structalias.c (find_what_var_points_to): Expand NONLOCAL inside ESCAPED. * gcc.dg/torture/pr61681.c: New testcase. From-SVN: r212349 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 726c86f4b6e8..3dcd84a66ef5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-07-08 Richard Biener + + PR tree-optimization/61681 + * tree-ssa-structalias.c (find_what_var_points_to): Expand + NONLOCAL inside ESCAPED. + 2014-07-08 Richard Biener PR tree-optimization/61680 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 523e6c423556..635f8ea179c6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-08 Richard Biener + + PR tree-optimization/61681 + * gcc.dg/torture/pr61681.c: New testcase. + 2014-07-08 Richard Biener PR tree-optimization/61680 diff --git a/gcc/testsuite/gcc.dg/torture/pr61681.c b/gcc/testsuite/gcc.dg/torture/pr61681.c new file mode 100644 index 000000000000..226de0c1aa73 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr61681.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ + +extern void abort (void); + +int a = 1, *e = &a, **f = &e, *l, *p, j; +static int b; +long d; +short g; + +void +fn1 (int *p) +{ + int m; + if (!(*p & j)) + { + int *n = &m; + for (d = 6; d; d--) + { + for (g = 0; g < 1; g++) + { + n = l = *f; + b = *p; + } + *n = 0; + } + } +} + +int +main () +{ + p = *f; + fn1 (p); + if (b != 0) + abort (); + return 0; +} diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 0472239f5b02..221877e955f4 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -6106,6 +6106,10 @@ find_what_var_points_to (varinfo_t orig_vi) pt->ipa_escaped = 1; else pt->escaped = 1; + /* Expand some special vars of ESCAPED in-place here. */ + varinfo_t evi = get_varinfo (find (escaped_id)); + if (bitmap_bit_p (evi->solution, nonlocal_id)) + pt->nonlocal = 1; } else if (vi->id == nonlocal_id) pt->nonlocal = 1;