From bc91c4361527fb229ad47f20a45de0b3160f2de9 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 22 Jul 2016 12:19:57 +0200 Subject: [PATCH] Consider functions with xloc.file == NULL (PR PR gcov-profile/69028 PR gcov-profile/62047 * g++.dg/cilk-plus/pr69028.C: New test. PR gcov-profile/69028 PR gcov-profile/62047 * cilk.c (create_cilk_helper_decl): Set location of a new decl to the current_function_decl. PR gcov-profile/69028 PR gcov-profile/62047 * coverage.c (coverage_compute_lineno_checksum): Do not calculate checksum for fns w/o xloc.file. (coverage_compute_profile_id): Likewise. From-SVN: r238637 --- gcc/ChangeLog | 8 ++++++++ gcc/c-family/ChangeLog | 7 +++++++ gcc/c-family/cilk.c | 5 +++-- gcc/coverage.c | 6 ++++-- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cilk-plus/pr69028.C | 13 +++++++++++++ 6 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cilk-plus/pr69028.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 36104da3cc4..f889abd3212 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-07-22 Martin Liska + + PR gcov-profile/69028 + PR gcov-profile/62047 + * coverage.c (coverage_compute_lineno_checksum): Do not + calculate checksum for fns w/o xloc.file. + (coverage_compute_profile_id): Likewise. + 2016-07-22 Georg-Johann Lay * config/avr/avr.c (TARGET_SECONDARY_RELOAD): Remove hook define... diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e244e8aea01..ba6093af6f6 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2016-07-22 Martin Liska + + PR gcov-profile/69028 + PR gcov-profile/62047 + * cilk.c (create_cilk_helper_decl): Set location of a new decl + to the current_function_decl. + 2016-07-21 Jason Merrill PR c++/65168 diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c index 8f34cd6c5e4..39781c483a0 100644 --- a/gcc/c-family/cilk.c +++ b/gcc/c-family/cilk.c @@ -312,8 +312,9 @@ create_cilk_helper_decl (struct wrapper_data *wd) gcc_unreachable (); clean_symbol_name (name); - tree fndecl = build_decl (UNKNOWN_LOCATION, FUNCTION_DECL, - get_identifier (name), wd->fntype); + + tree fndecl = build_decl (DECL_SOURCE_LOCATION (current_function_decl), + FUNCTION_DECL, get_identifier (name), wd->fntype); TREE_PUBLIC (fndecl) = 0; TREE_STATIC (fndecl) = 1; diff --git a/gcc/coverage.c b/gcc/coverage.c index 67cc908cbf5..d4d371ecd6d 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/ChangeLog b/gcc/testsuite/ChangeLog index 662eda641ac..656a6c23dda 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-07-22 Martin Liska + + PR gcov-profile/69028 + PR gcov-profile/62047 + * g++.dg/cilk-plus/pr69028.C: New test. + 2016-07-22 Andre Vehreschild * gfortran.dg/coarray_stat_2.f90: New test. 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 00000000000..31542f34e9a --- /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.30.2