go-fuzz icon indicating copy to clipboard operation
go-fuzz copied to clipboard

coverage bug when using goto labelled statement

Open jscrockett01 opened this issue 8 years ago • 3 comments
trafficstars

Coverage instrumentation is incorrect for labelled statements that are the target of a goto. This bug has been fixed in go's cmd/cover here:

https://github.com/golang/go/issues/16624

https://go-review.googlesource.com/#/c/30977/

jscrockett01 avatar Feb 21 '17 19:02 jscrockett01

Is it actually an issue for go-fuzz? "not reporting 100% coverage" should not affect go-fuzz.

dvyukov avatar Feb 22 '17 06:02 dvyukov

It's only an issue in the sense that basic blocks around labeled statements are not all enumerated, so transitions between these states are missed when looking for additional coverage by fuzz inputs. It doesn't prevent the fuzzer from operating; it just doesn't have awareness of those states.

On Wed, Feb 22, 2017 at 1:37 AM Dmitry Vyukov [email protected] wrote:

Is it actually an issue for go-fuzz? "not reporting 100% coverage" should not affect go-fuzz.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dvyukov/go-fuzz/issues/156#issuecomment-281583073, or mute the thread https://github.com/notifications/unsubscribe-auth/AJS3sZgY1k7icgSisVom2rKuZmAXLH_kks5re9fBgaJpZM4MHvsl .

jscrockett01 avatar Feb 22 '17 13:02 jscrockett01

I believe the best fix here is to rewrite our coverage instruction to use cmd/internal/edit, at which point we can benefit from improvements made to cmd/cover. Related: https://github.com/golang/go/issues/29824. Ultimately it would be nice to merge the two of them, but using the same basic mechanism is a good start towards that goal.

Unfortunately, switching to cmd/internal/edit is not as simple as it sounds. I tried to do it as part of the switch to go/packages and eventually gave up. It is possible...just complicated.

josharian avatar May 08 '19 20:05 josharian