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));
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;
}
--- /dev/null
+/* { dg-options "-fprofile-arcs -ftest-coverage -Ofast" } */
+/* { dg-do run { target native } } */
+
+#include <iostream>
+
+void __attribute__ ((noinline))
+ Out (std::ostream &out, double x)
+{ out << x << std::endl; } /* count(1) */
+
+int main ()
+{
+ Out (std::cout, 1.5); /* count(1) */
+ return 0;
+}
+
+/* { dg-final { run-gcov gcov-14.C } } */