aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.cc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2023-01-24 14:39:11 +0100
committerMartin Liska <mliska@suse.cz>2023-02-01 15:18:14 +0100
commit78589691ee158e689fa9bb7dec1165da475ea634 (patch)
tree8ed9bdcedc517346db1b2ad1a6efaf6262a02843 /gcc/cgraphunit.cc
parentbf2cf6f3f1851054237ee7df99bdf60bf5a3e3ae (diff)
downloadgcc-78589691ee158e689fa9bb7dec1165da475ea634.zip
gcc-78589691ee158e689fa9bb7dec1165da475ea634.tar.gz
gcc-78589691ee158e689fa9bb7dec1165da475ea634.tar.bz2
ipa: check if cache_token != NULL before hash_set::add call
We should not insert an empty value to the container. PR ipa/108509 gcc/ChangeLog: * cgraphunit.cc (walk_polymorphic_call_targets): Insert ony non-null values. * ipa.cc (walk_polymorphic_call_targets): Likewise. gcc/testsuite/ChangeLog: * g++.dg/ipa/pr108509.C: New test.
Diffstat (limited to 'gcc/cgraphunit.cc')
-rw-r--r--gcc/cgraphunit.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/cgraphunit.cc b/gcc/cgraphunit.cc
index 832818d..a972900 100644
--- a/gcc/cgraphunit.cc
+++ b/gcc/cgraphunit.cc
@@ -1000,7 +1000,7 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets,
= possible_polymorphic_call_targets
(edge, &final, &cache_token);
- if (!reachable_call_targets->add (cache_token))
+ if (cache_token != NULL && !reachable_call_targets->add (cache_token))
{
if (symtab->dump_file)
dump_possible_polymorphic_call_targets