Hi. Following patch addresses ICE which happens when coverage.c computes checksum of a function w/o xloc.file. My patch assumes it's a valid state having a function w/o xloc.file, which is situation exposed by cilkplus functions.
Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin
>From ac1ba622f394d9914c5f8250719780595f54b571 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Wed, 20 Jul 2016 09:54:12 +0200 Subject: [PATCH] Consider functions with xloc.file == NULL (PR gcov-profile/69028) gcc/testsuite/ChangeLog: 2016-07-20 Martin Liska <mli...@suse.cz> PR gcov-profile/69028 PR gcov-profile/62047 * g++.dg/cilk-plus/pr69028.C: New test. gcc/ChangeLog: 2016-07-20 Martin Liska <mli...@suse.cz> * coverage.c (coverage_compute_lineno_checksum): Do not calculate checksum for fns w/o xloc.file. (coverage_compute_profile_id): Likewise. --- gcc/coverage.c | 6 ++++-- gcc/testsuite/g++.dg/cilk-plus/pr69028.C | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cilk-plus/pr69028.C diff --git a/gcc/coverage.c b/gcc/coverage.c index 67cc908..d4d371e 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -553,7 +553,8 @@ coverage_compute_lineno_checksum (void) = expand_location (DECL_SOURCE_LOCATION (current_function_decl)); unsigned chksum = xloc.line; - chksum = coverage_checksum_string (chksum, xloc.file); + if (xloc.file) + chksum = coverage_checksum_string (chksum, xloc.file); chksum = coverage_checksum_string (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl))); @@ -580,7 +581,8 @@ coverage_compute_profile_id (struct cgraph_node *n) bool use_name_only = (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID) == 0); chksum = (use_name_only ? 0 : xloc.line); - chksum = coverage_checksum_string (chksum, xloc.file); + if (xloc.file) + chksum = coverage_checksum_string (chksum, xloc.file); chksum = coverage_checksum_string (chksum, IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (n->decl))); if (!use_name_only && first_global_object_name) diff --git a/gcc/testsuite/g++.dg/cilk-plus/pr69028.C b/gcc/testsuite/g++.dg/cilk-plus/pr69028.C new file mode 100644 index 0000000..31542f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cilk-plus/pr69028.C @@ -0,0 +1,13 @@ +// PR c++/69028 +// { dg-require-effective-target c++11 } +// { dg-options "-fcilkplus -fprofile-arcs" } + +void parallel() +{ +} + +int main() +{ + _Cilk_spawn parallel(); + _Cilk_sync; +} -- 2.9.0