Commit 2386834b authored by Matthias Klose's avatar Matthias Klose

* Fix PR tree-optimization/89505, taken from the gcc-8 branch.

parent 7e72f640
gcc-7 (7.4.0-8) UNRELEASED; urgency=medium
* Fix PR tree-optimization/89505, taken from the gcc-8 branch.
-- Matthias Klose <doko@debian.org> Wed, 13 Mar 2019 21:38:19 +0100
gcc-7 (7.4.0-7) unstable; urgency=medium
* Update to SVN 20190308 (r269489) from the gcc-7-branch.
......
# DP: Fix PR tree-optimization/89505, taken from the gcc-8 branch.
gcc/
2019-03-05 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-02-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/89505
* tree-ssa-structalias.c (compute_dependence_clique): Make sure
to handle restrict pointed-to vars with multiple subvars
correctly.
gcc/testsuite/
2019-03-05 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-02-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/89505
* gcc.dg/torture/pr89505.c: New testcase.
--- a/src/gcc/tree-ssa-structalias.c
+++ b/src/gcc/tree-ssa-structalias.c
@@ -7552,7 +7552,10 @@
}
if (used)
{
- bitmap_set_bit (rvars, restrict_var->id);
+ /* Add all subvars to the set of restrict pointed-to set. */
+ for (unsigned sv = restrict_var->head; sv != 0;
+ sv = get_varinfo (sv)->next)
+ bitmap_set_bit (rvars, sv);
varinfo_t escaped = get_varinfo (find (escaped_id));
if (bitmap_bit_p (escaped->solution, restrict_var->id))
escaped_p = true;
--- a/src/gcc/testsuite/gcc.dg/torture/pr89505.c
+++ b/src/gcc/testsuite/gcc.dg/torture/pr89505.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+
+struct S { int i; void *p; int j; };
+int a;
+int __attribute__((noinline))
+foo (struct S * __restrict p, int q)
+{
+ int *x = &p->j;
+ if (q)
+ x = &a;
+ p->j = 1;
+ *x = 2;
+ return p->j;
+}
+
+int main()
+{
+ struct S s;
+ if (foo (&s, 0) != 2)
+ __builtin_abort ();
+ return 0;
+}
......@@ -93,6 +93,7 @@ debian_patches += \
gcc-force-cross-layout \
kfreebsd-decimal-float \
pr89585 \
pr89505 \
# FIXME: see #915194
# gcc-search-prefixed-as-ld \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment