diff options
author | Richard Biener <rguenther@suse.de> | 2021-01-19 14:21:41 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-01-19 14:32:25 +0100 |
commit | 66dd412feeab29783fcdcf7ab36f20c5dd7b2332 (patch) | |
tree | a077959253ac3ac7378924674fb17b507347150d /gcc/ipa-modref.c | |
parent | f27cd6f42261e838677dfd0652f09cc0dfd6a42b (diff) | |
download | gcc-66dd412feeab29783fcdcf7ab36f20c5dd7b2332.zip gcc-66dd412feeab29783fcdcf7ab36f20c5dd7b2332.tar.gz gcc-66dd412feeab29783fcdcf7ab36f20c5dd7b2332.tar.bz2 |
ipa/98330 - avoid ICEing on call indirect call
The following avoids ICEing on a indirect calls with a fnspec
in modref analysis.
2021-01-19 Richard Biener <rguenther@suse.de>
PR ipa/98330
* ipa-modref.c (analyze_stmt): Only record a summary for a
direct call.
* g++.dg/pr98330.C: New testcase.
* gcc.dg/pr98330.c: Likewise.
Diffstat (limited to 'gcc/ipa-modref.c')
-rw-r--r-- | gcc/ipa-modref.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 74ad876..8a5669c 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1247,11 +1247,13 @@ analyze_stmt (modref_summary *summary, modref_summary_lto *summary_lto, && (!fnspec.global_memory_read_p () || !fnspec.global_memory_written_p ())) { - fnspec_summaries->get_create - (cgraph_node::get (current_function_decl)->get_edge (stmt)) - ->fnspec = xstrdup (fnspec.get_str ()); - if (dump_file) - fprintf (dump_file, " Recorded fnspec %s\n", fnspec.get_str ()); + cgraph_edge *e = cgraph_node::get (current_function_decl)->get_edge (stmt); + if (e->callee) + { + fnspec_summaries->get_create (e)->fnspec = xstrdup (fnspec.get_str ()); + if (dump_file) + fprintf (dump_file, " Recorded fnspec %s\n", fnspec.get_str ()); + } } } return true; |