]> git.ipfire.org Git - thirdparty/gcc.git/commit
gcov-profile/114715 - missing coverage for switch
authorRichard Biener <rguenther@suse.de>
Mon, 15 Apr 2024 09:09:17 +0000 (11:09 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 3 May 2024 12:47:57 +0000 (14:47 +0200)
commit5a3cc62dbb45185dd1ca32caec80d57a320ec5a0
tree2da306420e3c20fbead62edf8f2f98cc94cae7a4
parentd040606257a579f120271dcd2af62a3458a7856e
gcov-profile/114715 - missing coverage for switch

The following avoids missing coverage for the line of a switch statement
which happens when gimplification emits a BIND_EXPR wrapping the switch
as that prevents us from setting locations on the containing statements
via annotate_all_with_location.  Instead set the location of the GIMPLE
switch directly.

PR gcov-profile/114715
* gimplify.cc (gimplify_switch_expr): Set the location of the
GIMPLE switch.

* gcc.misc-tests/gcov-24.c: New testcase.

(cherry picked from commit 9d573f71e80e9f6f4aac912fc8fc128aa2697e3a)
gcc/gimplify.cc
gcc/testsuite/gcc.misc-tests/gcov-24.c [new file with mode: 0644]