Consider functions with xloc.file == NULL (PR
authorMartin Liska <mliska@suse.cz>
Fri, 22 Jul 2016 10:19:57 +0000 (12:19 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 22 Jul 2016 10:19:57 +0000 (10:19 +0000)
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
gcc/c-family/ChangeLog
gcc/c-family/cilk.c
gcc/coverage.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cilk-plus/pr69028.C [new file with mode: 0644]

index 36104da3cc490b738aac7deb7e2dc8e7423e4244..f889abd32126d7db4d90d3d0e1fab6e46a36fa71 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-22  Martin Liska  <mliska@suse.cz>
+
+       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  <avr@gjlay.de>
 
        * config/avr/avr.c (TARGET_SECONDARY_RELOAD): Remove hook define...
index e244e8aea014cc61fb1ed91f97d4cc81aab6c960..ba6093af6f68f74f208dd3135825c368f10f27da 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-22  Martin Liska  <mliska@suse.cz>
+
+       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  <jason@redhat.com>
 
        PR c++/65168
index 8f34cd6c5e4f690d86600295ce54dfd426024280..39781c483a0095e876297355b2e5a5daa4f40a61 100644 (file)
@@ -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;
index 67cc908cbf580cdf093ac0bf6d57e24d66439eb9..d4d371ecd6d403b4407946619e61628a18024ad9 100644 (file)
@@ -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)
index 662eda641ac4e3c66b2bf9dd26c1940d4b0d06b6..656a6c23ddafa1114b5a54b5e4c5f51e7d3ceb7f 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-22  Martin Liska  <mliska@suse.cz>
+
+       PR gcov-profile/69028
+       PR gcov-profile/62047
+       * g++.dg/cilk-plus/pr69028.C: New test.
+
 2016-07-22  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        * 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 (file)
index 0000000..31542f3
--- /dev/null
@@ -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;
+}