michael@0: 2012-12-12 Jakub Jelinek michael@0: michael@0: PR gcov-profile/55650 michael@0: * coverage.c (coverage_obj_init): Return false if no functions michael@0: are being emitted. michael@0: michael@0: * g++.dg/other/pr55650.C: New test. michael@0: * g++.dg/other/pr55650.cc: New file. michael@0: michael@0: --- gcc/coverage.c.jj 2012-11-19 14:41:24.000000000 +0100 michael@0: +++ gcc/coverage.c 2012-12-12 08:54:35.005180211 +0100 michael@0: @@ -999,6 +999,9 @@ coverage_obj_init (void) michael@0: /* The function is not being emitted, remove from list. */ michael@0: *fn_prev = fn->next; michael@0: michael@0: + if (functions_head == NULL) michael@0: + return false; michael@0: + michael@0: for (ix = 0; ix != GCOV_COUNTERS; ix++) michael@0: if ((1u << ix) & prg_ctr_mask) michael@0: n_counters++; michael@0: --- gcc/testsuite/g++.dg/other/pr55650.C.jj 2012-12-12 09:03:53.342876593 +0100 michael@0: +++ gcc/testsuite/g++.dg/other/pr55650.C 2012-12-12 09:03:11.000000000 +0100 michael@0: @@ -0,0 +1,21 @@ michael@0: +// PR gcov-profile/55650 michael@0: +// { dg-do link } michael@0: +// { dg-options "-O2 -fprofile-generate" } michael@0: +// { dg-additional-sources "pr55650.cc" } michael@0: + michael@0: +struct A michael@0: +{ michael@0: + virtual void foo (); michael@0: +}; michael@0: + michael@0: +struct B : public A michael@0: +{ michael@0: + B (); michael@0: + void foo () {} michael@0: +}; michael@0: + michael@0: +inline A * michael@0: +bar () michael@0: +{ michael@0: + return new B; michael@0: +} michael@0: --- gcc/testsuite/g++.dg/other/pr55650.cc.jj 2012-12-12 09:03:56.329858741 +0100 michael@0: +++ gcc/testsuite/g++.dg/other/pr55650.cc 2012-12-12 09:03:48.982900718 +0100 michael@0: @@ -0,0 +1,4 @@ michael@0: +int michael@0: +main () michael@0: +{ michael@0: +}