aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2011-12-10 08:32:34 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2011-12-10 08:32:34 +0000
commit2ac69a0c6c54cc878a732ae9a647ac701396ad2f (patch)
tree33bb7445e0b0a2b4ce75136a68cb0e1aab95ae2a /gcc/coverage.c
parente2d049842c0f4f090e931e935f9ac722a2881f6c (diff)
downloadgcc-2ac69a0c6c54cc878a732ae9a647ac701396ad2f.zip
gcc-2ac69a0c6c54cc878a732ae9a647ac701396ad2f.tar.gz
gcc-2ac69a0c6c54cc878a732ae9a647ac701396ad2f.tar.bz2
re PR gcov-profile/51449 (Rev181994 causes tramp3d-v4 profiled build failure)
PR gcov-profile/51449 * coverage.c (coverage_end_function): Always process the coverage variables. testsuite/ * g++.dg/gcov/gcov-14.C: New. From-SVN: r182184
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 656db92..58a76ca 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -604,20 +604,33 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
bbg_file_name = NULL;
}
- /* If the function is extern (i.e. extern inline), then we won't be
- outputting it, so don't chain it onto the function list. */
- if (fn_ctr_mask && !DECL_EXTERNAL (current_function_decl))
+ if (fn_ctr_mask)
{
- struct coverage_data *item = ggc_alloc_coverage_data ();
+ struct coverage_data *item = 0;
+
+ /* If the function is extern (i.e. extern inline), then we won't
+ be outputting it, so don't chain it onto the function
+ list. */
+ if (!DECL_EXTERNAL (current_function_decl))
+ {
+ item = ggc_alloc_coverage_data ();
+
+ item->ident = current_function_funcdef_no + 1;
+ item->lineno_checksum = lineno_checksum;
+ item->cfg_checksum = cfg_checksum;
+
+ item->fn_decl = current_function_decl;
+ item->next = 0;
+ *functions_tail = item;
+ functions_tail = &item->next;
+ }
- item->ident = current_function_funcdef_no + 1;
- item->lineno_checksum = lineno_checksum;
- item->cfg_checksum = cfg_checksum;
for (i = 0; i != GCOV_COUNTERS; i++)
{
tree var = fn_v_ctrs[i];
-
- item->ctr_vars[i] = var;
+
+ if (item)
+ item->ctr_vars[i] = var;
if (var)
{
tree array_type = build_index_type (size_int (fn_n_ctrs[i] - 1));
@@ -627,17 +640,7 @@ coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
DECL_SIZE_UNIT (var) = TYPE_SIZE_UNIT (array_type);
varpool_finalize_decl (var);
}
- }
- item->fn_decl = current_function_decl;
- item->next = 0;
- *functions_tail = item;
- functions_tail = &item->next;
- }
-
- if (fn_ctr_mask)
- {
- for (i = 0; i != GCOV_COUNTERS; i++)
- {
+
fn_b_ctrs[i] = fn_n_ctrs[i] = 0;
fn_v_ctrs[i] = NULL_TREE;
}