https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98631
Bug ID: 98631
Summary: exception hit once reported twice
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
I've got the following complaint: with the attached testcase (m.C):
$ g++ -fprofile-arcs -ftest-coverage -g m.C
$ ./a.out
caught
$ gcov m.C
File 'm.C'
Lines executed:90.91% of 11
Creating 'm.C.gcov'
$ less m.C.gcov
-: 0:Source:m.C
-: 0:Graph:m.gcno
-: 0:Data:m.gcda
-: 0:Runs:1
-: 1:struct S {
1: 2: S() {
1: 3: foo ();
1: 4: bar ();
#####: 5: }
1: 6: void foo () { }
1: 7: void bar () { throw 1; }
-: 8:};
-: 9:
-: 10:int
1: 11:main ()
-: 12:{
-: 13: try {
1: 14: S s;
2: 15: } catch(...) {
1: 16: __builtin_printf ("caught\n");
-: 17: }
1: 18:}
this shows that line 15 was executed twice, which seems dubious. Then this
doesn't play well with tools like "perf stat" -- it results in two uprobes.
$ less m.C
struct S {
S() {
foo ();
bar ();
}
void foo () { }
void bar () { throw 1; }
};
int
main ()
{
try {
S s;
} catch(...) {
__builtin_printf ("caught\n");
}
}