|
1 2012-12-12 Jakub Jelinek <jakub@redhat.com> |
|
2 |
|
3 PR gcov-profile/55650 |
|
4 * coverage.c (coverage_obj_init): Return false if no functions |
|
5 are being emitted. |
|
6 |
|
7 * g++.dg/other/pr55650.C: New test. |
|
8 * g++.dg/other/pr55650.cc: New file. |
|
9 |
|
10 --- gcc/coverage.c.jj 2012-11-19 14:41:24.000000000 +0100 |
|
11 +++ gcc/coverage.c 2012-12-12 08:54:35.005180211 +0100 |
|
12 @@ -999,6 +999,9 @@ coverage_obj_init (void) |
|
13 /* The function is not being emitted, remove from list. */ |
|
14 *fn_prev = fn->next; |
|
15 |
|
16 + if (functions_head == NULL) |
|
17 + return false; |
|
18 + |
|
19 for (ix = 0; ix != GCOV_COUNTERS; ix++) |
|
20 if ((1u << ix) & prg_ctr_mask) |
|
21 n_counters++; |
|
22 --- gcc/testsuite/g++.dg/other/pr55650.C.jj 2012-12-12 09:03:53.342876593 +0100 |
|
23 +++ gcc/testsuite/g++.dg/other/pr55650.C 2012-12-12 09:03:11.000000000 +0100 |
|
24 @@ -0,0 +1,21 @@ |
|
25 +// PR gcov-profile/55650 |
|
26 +// { dg-do link } |
|
27 +// { dg-options "-O2 -fprofile-generate" } |
|
28 +// { dg-additional-sources "pr55650.cc" } |
|
29 + |
|
30 +struct A |
|
31 +{ |
|
32 + virtual void foo (); |
|
33 +}; |
|
34 + |
|
35 +struct B : public A |
|
36 +{ |
|
37 + B (); |
|
38 + void foo () {} |
|
39 +}; |
|
40 + |
|
41 +inline A * |
|
42 +bar () |
|
43 +{ |
|
44 + return new B; |
|
45 +} |
|
46 --- gcc/testsuite/g++.dg/other/pr55650.cc.jj 2012-12-12 09:03:56.329858741 +0100 |
|
47 +++ gcc/testsuite/g++.dg/other/pr55650.cc 2012-12-12 09:03:48.982900718 +0100 |
|
48 @@ -0,0 +1,4 @@ |
|
49 +int |
|
50 +main () |
|
51 +{ |
|
52 +} |