I wrote:
> ... I have a question in
> to the lcov mailing list at sourceforge to see if anyone wants to offer
> a more informed opinion, though.
And the authoritative answer is: the bug is in gcc/gcov. The
branch_coverage switch implies passing "-a" to gcov, and if you do
that (with "make coverage GCOVFLAGS=-a" in our infrastructure),
you get output like this (tested with gcc 7.3.1):
-: 485: clause,
-: 486: weak);
-: 487: }
#####: 488: break;
$$$$$: 488-block 0
-: 489: }
-: 490:
-: 491: /* can't get here */
5134: 492: elog(ERROR, "predicate_classify returned a bogus value");
$$$$$: 492-block 0
call 0 never executed
call 1 never executed
call 2 never executed
5134: 492-block 1
-: 493: return false;
-: 494:}
which is clearly claiming that the second basic block in line 492 gets
executed.
With gcc 8.0.1 I instead get:
-: 485: clause,
-: 486: weak);
-: 487: }
#####: 488: break;
%%%%%: 488-block 0
-: 489: }
-: 490:
-: 491: /* can't get here */
#####: 492: elog(ERROR, "predicate_classify returned a bogus value");
%%%%%: 492-block 0
call 0 never executed
call 1 never executed
call 2 never executed
-: 493: return false;
-: 494:}
The fact that they changed the gcov data format at the same time hints
that it may be unfixable without such a change, though I've not tried to
excavate in their changelog for more info. It could also just be a code
generation change, seeing that 8.0.1 is not claiming there are 2 basic
blocks anymore. (Hm, I wonder whether our "pg_unreachable" stuff confuses
the earlier releases.)
regards, tom lane