public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/gcc-9)] IPA: Avoid segfault in devirtualization_time_bonus (PR 93223)
@ 2020-02-04 21:12 Peter Bergner
0 siblings, 0 replies; only message in thread
From: Peter Bergner @ 2020-02-04 21:12 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b849001991c41b68407e7b0bcabf88e4ef414fff
commit b849001991c41b68407e7b0bcabf88e4ef414fff
Author: Martin Jambor <mjambor@suse.cz>
Date: Tue Jan 14 19:05:56 2020 +0100
IPA: Avoid segfault in devirtualization_time_bonus (PR 93223)
2020-01-14 Martin Jambor <mjambor@suse.cz>
PR ipa/93223
* ipa-cp.c (devirtualization_time_bonus): Check whether isummary is
NULL.
testsuite/
* g++.dg/ipa/pr93223.C: New test.
Diff:
---
gcc/ChangeLog | 9 ++++++
gcc/ipa-cp.c | 2 +-
gcc/testsuite/ChangeLog | 8 +++++
gcc/testsuite/g++.dg/ipa/pr93223.C | 62 ++++++++++++++++++++++++++++++++++++++
4 files changed, 80 insertions(+), 1 deletion(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 614fdc1..861a806 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-14 Martin Jambor <mjambor@suse.cz>
+
+ Backport from mainline
+ 2020-01-13 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/93223
+ * ipa-cp.c (devirtualization_time_bonus): Check whether isummary is
+ NULL.
+
2020-01-10 Martin Jambor <mjambor@suse.cz>
Backport from mainline
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 36ec54d..9840394 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -2567,7 +2567,7 @@ devirtualization_time_bonus (struct cgraph_node *node,
if (avail < AVAIL_AVAILABLE)
continue;
isummary = ipa_fn_summaries->get (callee);
- if (!isummary->inlinable)
+ if (!isummary || !isummary->inlinable)
continue;
/* FIXME: The values below need re-considering and perhaps also
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f5c1c20..12d7839 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2020-01-14 Martin Jambor <mjambor@suse.cz>
+
+ Backport from mainline
+ 2020-01-13 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/93223
+ * g++.dg/ipa/pr93223.C: New test.
+
2020-01-13 Joseph Myers <joseph@codesourcery.com>
Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/ipa/pr93223.C b/gcc/testsuite/g++.dg/ipa/pr93223.C
new file mode 100644
index 0000000..87f98b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr93223.C
@@ -0,0 +1,62 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -std=gnu++14" } */
+
+template <typename Function>
+bool run(const int item_count,
+ Function && process_range,
+ const int max_parallelism,
+ int* progress = nullptr)
+{
+ if (max_parallelism <= 1)
+ {
+ if (progress == nullptr)
+ {
+ return process_range(0);
+ }
+ else
+ {
+ auto result = true;
+ for (int i = 0; i != item_count && result; ++i)
+ {
+ (*progress)++;
+ result = process_range(i);
+ }
+ return result;
+ }
+ }
+
+ if (max_parallelism > 10)
+ {
+ if (progress == nullptr)
+ {
+ return process_range(0);
+ }
+ else
+ {
+ auto result = true;
+ for (int i = 0; i != item_count && result; ++i)
+ {
+ (*progress)++;
+ result = process_range(i);
+ }
+ return result;
+ }
+ }
+ return false;
+}
+
+namespace
+{
+__attribute__((optimize(0))) bool worker_fun(const int)
+{
+ return true;
+}
+}
+
+void demo(int n)
+{
+ for (int i = 0; i < n; ++i)
+ {
+ run(n, &worker_fun, n);
+ }
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-04 21:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 21:12 [gcc(refs/vendors/ibm/heads/gcc-9)] IPA: Avoid segfault in devirtualization_time_bonus (PR 93223) Peter Bergner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).