Re: [PATCH] testsuite: Use sigsetjmp in gcc.misc-tests/gcov-31.c

2025-04-22 Thread Jørgen Kvalsvik
Hi, Thanks for fixing this. I just checked glibc, which implements __sigsetjmp as: # define sigsetjmp(env, savemask) __sigsetjmp (env, savemask) So I would think this is fine. I leave the ack to the Jakub, Richard et al, of course. Thanks, Jørgen On 2025-04-22 10:33, Rainer Orth wrote: T

[pushed] Only write gcov when file output is on [PR119553]

2025-03-31 Thread Jørgen Kvalsvik
gcov_write_* functions must be guarded so they only are called when output_to_file is true, like for -fcondition-coverage, otherwise it triggers an invalid read as detected by valgrind. The gcno file is mostly written to from profile.cc, so it doesn't make too much sense to hide it in path-coverage

[pushed] Add coverage_instrumentation_p

2025-03-26 Thread Jørgen Kvalsvik
Provide a helper for checking if any coverage (arc, conditions, paths) is enabled, rather than manually checking all the flags. This should make the intent clearer, and make it easier to maintain the checks when more flags are added. The function is forward declared in two header files as differen

[pushed] gcov: branch, conds, calls in function summaries

2025-03-26 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

Re: [PATCH 2/2] Add prime path coverage to gcc/gcov

2025-03-26 Thread Jørgen Kvalsvik
On 3/26/25 20:49, Jørgen Kvalsvik wrote: On 3/26/25 14:54, Jan Hubicka wrote: Hello, I apologize for late reply here.  I went thru the paper in gereater detail. While I originally though the usual path-profiling can be reasonably merged with the prime math profiling, so it is useful both for

Re: [PATCH 2/2] Add prime path coverage to gcc/gcov

2025-03-26 Thread Jørgen Kvalsvik
On 3/26/25 14:54, Jan Hubicka wrote: Hello, I apologize for late reply here. I went thru the paper in gereater detail. While I originally though the usual path-profiling can be reasonably merged with the prime math profiling, so it is useful both for optimizaiton and coverage testing, I think it

Ping [PATCH 0/2] v2 Add prime path coverage to gcc/gcov

2025-03-19 Thread Jørgen Kvalsvik
Ping. On 3/5/25 20:21, Jørgen Kvalsvik wrote: Ping. On 2/21/25 19:15, Jørgen Kvalsvik wrote: Ping On 2/12/25 16:30, Jørgen Kvalsvik wrote: I have applied fixes for everything in the last review, plus some GNU style fixes that I had missed previously. We have tested and used a build with

Ping [PATCH] Record, report basic blocks of conditional exprs

2025-03-05 Thread Jørgen Kvalsvik
Ping. On 2/12/25 19:00, Jørgen Kvalsvik wrote: Ping. On 1/31/25 10:35, Jørgen Kvalsvik wrote: Record basic blocks that make up a conditional expression with -fcondition-coverage and report when using the gcov -w/--verbose flag. This makes the report more accurate when basic blocks are

Ping [PATCH 0/2] v2 Add prime path coverage to gcc/gcov

2025-03-05 Thread Jørgen Kvalsvik
Ping. On 2/21/25 19:15, Jørgen Kvalsvik wrote: Ping On 2/12/25 16:30, Jørgen Kvalsvik wrote: I have applied fixes for everything in the last review, plus some GNU style fixes that I had missed previously. We have tested and used a build with this applied for 3-4 months now and haven'

Ping [PATCH 0/2] v2 Add prime path coverage to gcc/gcov

2025-02-21 Thread Jørgen Kvalsvik
Ping On 2/12/25 16:30, Jørgen Kvalsvik wrote: I have applied fixes for everything in the last review, plus some GNU style fixes that I had missed previously. We have tested and used a build with this applied for 3-4 months now and haven't run into any issues. Jørgen Kvalsvik (2):

Ping [PATCH] Record, report basic blocks of conditional exprs

2025-02-12 Thread Jørgen Kvalsvik
Ping. On 1/31/25 10:35, Jørgen Kvalsvik wrote: Record basic blocks that make up a conditional expression with -fcondition-coverage and report when using the gcov -w/--verbose flag. This makes the report more accurate when basic blocks are included as there may be blocks in-between the actual

[PATCH 0/2] v2 Add prime path coverage to gcc/gcov

2025-02-12 Thread Jørgen Kvalsvik
I have applied fixes for everything in the last review, plus some GNU style fixes that I had missed previously. We have tested and used a build with this applied for 3-4 months now and haven't run into any issues. Jørgen Kvalsvik (2): gcov: branch, conds, calls in function summaries Add

[PATCH 1/2] gcov: branch, conds, calls in function summaries

2025-02-12 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

Re: [PATCH 2/2] Add prime path coverage to gcc/gcov

2025-01-31 Thread Jørgen Kvalsvik
Ping. Should I apply these changes and re-submit, or would you like to see more changes? Thanks, Jørgen On 1/5/25 22:06, Jørgen Kvalsvik wrote: On 1/5/25 20:53, Jørgen Kvalsvik wrote: On 1/5/25 20:25, Jan Hubicka wrote: ALGORITHM Since the numbers of paths grows so fast, we need a good

[PATCH] Record, report basic blocks of conditional exprs

2025-01-31 Thread Jørgen Kvalsvik
Record basic blocks that make up a conditional expression with -fcondition-coverage and report when using the gcov -w/--verbose flag. This makes the report more accurate when basic blocks are included as there may be blocks in-between the actual Boolean expressions, e.g. when there a term is the re

Re: [PATCH 2/2] Add prime path coverage to gcc/gcov

2025-01-05 Thread Jørgen Kvalsvik
On 1/5/25 20:53, Jørgen Kvalsvik wrote: On 1/5/25 20:25, Jan Hubicka wrote: ALGORITHM Since the numbers of paths grows so fast, we need a good algorithm. The naive approach of generating all paths and discarding redundancies (see reference_prime_paths in the diff) simply doesn't complet

Re: [PATCH 2/2] Add prime path coverage to gcc/gcov

2025-01-05 Thread Jørgen Kvalsvik
On 1/5/25 20:25, Jan Hubicka wrote: ALGORITHM Since the numbers of paths grows so fast, we need a good algorithm. The naive approach of generating all paths and discarding redundancies (see reference_prime_paths in the diff) simply doesn't complete for even pretty simple functions with a few ten

Re: [PATCH 1/2] gcov: branch, conds, calls in function summaries

2025-01-05 Thread Jørgen Kvalsvik
On 1/5/25 18:23, Jan Hubicka wrote: The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o

Ping^7 [PATCH 0/2] Prime path coverage to gcc/gcov

2024-12-17 Thread Jørgen Kvalsvik
Ping. On 12/2/24 11:49, Jørgen Kvalsvik wrote: Ping. On 11/21/24 20:14, Jørgen Kvalsvik wrote: Ping. On 11/12/24 09:56, Jørgen Kvalsvik wrote: Ping. On 10/30/24 13:55, Jørgen Kvalsvik wrote: Ping. On 10/21/24 15:21, Jørgen Kvalsvik wrote: Ping. On 10/10/24 10:08, Jørgen Kvalsvik wrote

Ping^6 [PATCH 0/2] Prime path coverage to gcc/gcov

2024-12-02 Thread Jørgen Kvalsvik
Ping. On 11/21/24 20:14, Jørgen Kvalsvik wrote: Ping. On 11/12/24 09:56, Jørgen Kvalsvik wrote: Ping. On 10/30/24 13:55, Jørgen Kvalsvik wrote: Ping. On 10/21/24 15:21, Jørgen Kvalsvik wrote: Ping. On 10/10/24 10:08, Jørgen Kvalsvik wrote: Ping. On 10/3/24 12:46, Jørgen Kvalsvik wrote

Ping^5 [PATCH 0/2] Prime path coverage to gcc/gcov

2024-11-21 Thread Jørgen Kvalsvik
Ping. On 11/12/24 09:56, Jørgen Kvalsvik wrote: Ping. On 10/30/24 13:55, Jørgen Kvalsvik wrote: Ping. On 10/21/24 15:21, Jørgen Kvalsvik wrote: Ping. On 10/10/24 10:08, Jørgen Kvalsvik wrote: Ping. On 10/3/24 12:46, Jørgen Kvalsvik wrote: This is both a ping and a minor update. A few of

Ping^4 [PATCH 0/2] Prime path coverage to gcc/gcov

2024-11-12 Thread Jørgen Kvalsvik
Ping. On 10/30/24 13:55, Jørgen Kvalsvik wrote: Ping. On 10/21/24 15:21, Jørgen Kvalsvik wrote: Ping. On 10/10/24 10:08, Jørgen Kvalsvik wrote: Ping. On 10/3/24 12:46, Jørgen Kvalsvik wrote: This is both a ping and a minor update. A few of the patches from the previous set have been

Ping^3 [PATCH 0/2] Prime path coverage to gcc/gcov

2024-10-30 Thread Jørgen Kvalsvik
Ping. On 10/21/24 15:21, Jørgen Kvalsvik wrote: Ping. On 10/10/24 10:08, Jørgen Kvalsvik wrote: Ping. On 10/3/24 12:46, Jørgen Kvalsvik wrote: This is both a ping and a minor update. A few of the patches from the previous set have been merged, but the big feature still needs review. Since

Ping^2 [PATCH 0/2] Prime path coverage to gcc/gcov

2024-10-21 Thread Jørgen Kvalsvik
Ping. On 10/10/24 10:08, Jørgen Kvalsvik wrote: Ping. On 10/3/24 12:46, Jørgen Kvalsvik wrote: This is both a ping and a minor update. A few of the patches from the previous set have been merged, but the big feature still needs review. Since then it has been quiet, but there are two notable

Re: [PATCH 0/2] Prime path coverage to gcc/gcov

2024-10-10 Thread Jørgen Kvalsvik
Ping. On 10/3/24 12:46, Jørgen Kvalsvik wrote: This is both a ping and a minor update. A few of the patches from the previous set have been merged, but the big feature still needs review. Since then it has been quiet, but there are two notable changes: 1. The --prime-paths-{lines,source

[PATCH 0/2] Prime path coverage to gcc/gcov

2024-10-03 Thread Jørgen Kvalsvik
objects. Jørgen Kvalsvik (2): gcov: branch, conds, calls in function summaries Add prime path coverage to gcc/gcov gcc/Makefile.in|6 +- gcc/builtins.cc|2 +- gcc/collect2.cc|5 +- gcc/common.opt

[PATCH 1/2] gcov: branch, conds, calls in function summaries

2024-10-03 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

Re: [PATCH 1/4] testsuite: Use dg-compile, not gcc -c

2024-09-08 Thread Jørgen Kvalsvik
On 8/23/24 09:41, Jan Hubicka wrote: Since this is a pure compile test it makes sense to inform dejagnu of it. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-23.c: Use dg-compile, not gcc -c OK, Honza Thanks, Pushed. --- gcc/testsuite/gcc.misc-tests/gcov-23.c | 3 ++- 1 file ch

Re: [PATCH 1/3] gcov: Cache source files

2024-09-08 Thread Jørgen Kvalsvik
On 8/23/24 09:39, Jan Hubicka wrote: Hi, 1:4:int notmain(const char *entity) -: == inlined from hello.h == 1:6: if (s) branch 0 taken 0 (fallthrough) branch 1 taken 1 #:7:printf ("hello, %s!\n", s); %:7-block 3 call0 never e

Re: [PATCH 1/3] gcov: Cache source files

2024-08-23 Thread Jørgen Kvalsvik
On 8/23/24 09:39, Jan Hubicka wrote: Hi, 1:4:int notmain(const char *entity) -: == inlined from hello.h == 1:6: if (s) branch 0 taken 0 (fallthrough) branch 1 taken 1 #:7:printf ("hello, %s!\n", s); %:7-block 3 call0 never e

Ping [PATCH 0/4] Prime path coverage in gcc/gcov

2024-08-23 Thread Jørgen Kvalsvik
Ping. On 8/15/24 10:15, Jørgen Kvalsvik wrote: Ping. Since the last patch I have fixed a few bugs in the path count limit aborting, and a few minor rephrases in docs. Jørgen Kvalsvik (4): testsuite: Use dg-compile, not gcc -c gcov: Cache source files gcov: branch, conds, calls in

[PATCH 2/3] gcov: branch, conds, calls in function summaries

2024-08-15 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

[PATCH 2/4] gcov: Cache source files

2024-08-15 Thread Jørgen Kvalsvik
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interact

[PATCH 1/3] gcov: Cache source files

2024-08-15 Thread Jørgen Kvalsvik
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interact

[PATCH 3/4] gcov: branch, conds, calls in function summaries

2024-08-15 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

[PATCH 1/4] testsuite: Use dg-compile, not gcc -c

2024-08-15 Thread Jørgen Kvalsvik
Since this is a pure compile test it makes sense to inform dejagnu of it. gcc/testsuite/ChangeLog: * gcc.misc-tests/gcov-23.c: Use dg-compile, not gcc -c --- gcc/testsuite/gcc.misc-tests/gcov-23.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.mis

[PATCH 0/4] Prime path coverage in gcc/gcov

2024-08-15 Thread Jørgen Kvalsvik
Ping. Since the last patch I have fixed a few bugs in the path count limit aborting, and a few minor rephrases in docs. Jørgen Kvalsvik (4): testsuite: Use dg-compile, not gcc -c gcov: Cache source files gcov: branch, conds, calls in function summaries Add prime path coverage to gcc/gcov

[PATCH 0/3] Prime path coverage in gcc/gcov

2024-08-08 Thread Jørgen Kvalsvik
y get stuck between checks. 3. Fixed some ICEs, mostly around setjmp. 4. Refactoring, comments. 5. Manual entries, --help. Jørgen Kvalsvik (3): gcov: Cache source files gcov: Add branch, conds, calls in function summary Add prime path coverage to gcc/gcov gcc/Makefi

[PATCH 1/3] gcov: Cache source files

2024-08-08 Thread Jørgen Kvalsvik
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interact

[PATCH 2/3] gcov: branch, conds, calls in function summaries

2024-08-08 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

[PATCH 2/3] Add branch, conds, calls in gcov function summary

2024-08-08 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

[PATCH 1/3] gcov: Cache source files

2024-08-08 Thread Jørgen Kvalsvik
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interact

[PATCH 2/3] gcov: branch, conds, calls in function summaries

2024-08-08 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage, calls, and condition coverage. $ gcc --coverage -fpath-coverage hello.c -o hello $ ./hello Before: $ gcov -

Re: [PATCH] Use foreach, not lmap, for tcl <= 8.5 compat

2024-07-17 Thread Jørgen Kvalsvik
Pushed. Thanks, Jørgen On 7/16/24 09:49, Roger Sayle wrote: Hi Jørgen, Awesome. Very many thanks for the speedy fix. Roger -- -Original Message- From: Jørgen Kvalsvik Sent: 14 July 2024 20:46 To: gcc-patches@gcc.gnu.org Cc: jeffreya...@gmail.com; ro...@nextmovesoftware.com; Jørgen

[PATCH] Use foreach, not lmap, for tcl <= 8.5 compat

2024-07-14 Thread Jørgen Kvalsvik
lmap was introduced in tcl 8.6, and while it was released in 2012, lmap does not really make too much of a difference to warrant the friction on consverative (and relevant) systems. gcc/testsuite/ChangeLog: * lib/gcov.exp: Use foreach for tcl <= 8.5. --- gcc/testsuite/lib/gcov.exp | 28 +

Re: [pushed] Add function filtering to gcov

2024-07-14 Thread Jørgen Kvalsvik
Certainly, I can rewrite from lmap. I'll send a patch shortly. On 7/14/24 16:27, Roger Sayle wrote: I’m seeing (dejagnu) testsuite problems from this (recent) patch. Running /home/roger/GCC/patchem/gcc/testsuite/gcc.misc-tests/gcov.exp ... ERROR: (DejaGnu) proc "lmap key { snd } { if

[pushed] Add function filtering to gcov

2024-07-11 Thread Jørgen Kvalsvik
Add the --include and --exclude flags to gcov to control what functions to report on. This is meant to make gcov more practical as an when writing test suites or performing other coverage experiments, which tends to focus on a few functions at the time. This really shines in combination with the -t

[pushed] Ensure function.end_line in source_info.lines

2024-07-11 Thread Jørgen Kvalsvik
Ensure that the function.end_line in the lines vector for the source file, even if it is not explicitly touched by a basic block. This ensures consistency with what you would expect. For example, this file has sources[sum.cc].lines.size () == 23 and main.end_line == 2 without adjusting sources.line

[PATCH 1/2] gcov: Cache source files

2024-07-11 Thread Jørgen Kvalsvik
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interact

Re: [PATCH] Add function filtering to gcov

2024-07-10 Thread Jørgen Kvalsvik
On 7/10/24 23:59, Jeff Law wrote: On 7/10/24 3:18 PM, Jørgen Kvalsvik wrote: On 7/10/24 21:54, Jeff Law wrote: On 7/10/24 1:30 PM, Jørgen Kvalsvik wrote: Thanks you -- before I move forward, I would like some feedback on adding this diff to the patch: diff --git a/gcc/gcov.cc b/gcc

Re: [PATCH] Add function filtering to gcov

2024-07-10 Thread Jørgen Kvalsvik
On 7/10/24 21:54, Jeff Law wrote: On 7/10/24 1:30 PM, Jørgen Kvalsvik wrote: Thanks you -- before I move forward, I would like some feedback on adding this diff to the patch: diff --git a/gcc/gcov.cc b/gcc/gcov.cc index 9cdef19c461..055fa7e78ba 100644 --- a/gcc/gcov.cc +++ b/gcc

Re: [PATCH] Add function filtering to gcov

2024-07-10 Thread Jørgen Kvalsvik
On 7/10/24 01:50, Jeff Law wrote: On 6/25/24 1:56 AM, Jørgen Kvalsvik wrote: Add the --include and --exclude flags to gcov to control what functions to report on. This is meant to make gcov more practical as an when writing test suites or performing other coverage experiments, which tends to

[PATCH] gcov: Cache source files

2024-07-04 Thread Jørgen Kvalsvik
Cache the source files as they are read, rather than discarding them at the end of output_lines (), and move the reading of the source file to the new function slurp. This patch does not really change anything other than moving the file reading out of output_file, but set gcov up for more interact

Re: [PATCH] Use move-aware auto_vec in map

2024-06-28 Thread Jørgen Kvalsvik
On 6/28/24 13:55, Richard Biener wrote: On Fri, Jun 28, 2024 at 8:43 AM Jørgen Kvalsvik wrote: Using auto_vec rather than vec for means the vectors are release automatically upon return, to stop the leak. The problem seems is that auto_vec is not really move-aware, only the specialization is

[PATCH] Use move-aware auto_vec in map

2024-06-27 Thread Jørgen Kvalsvik
Using auto_vec rather than vec for means the vectors are release automatically upon return, to stop the leak. The problem seems is that auto_vec is not really move-aware, only the specialization is. This is actually Jan's original suggestion https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655

Re: [PATCH 1/3] Release structures on function return

2024-06-26 Thread Jørgen Kvalsvik
I think we need to revert this. I got this email from linaro/gcc-regressions: [Linaro-TCWG-CI] gcc-15-1649-g19f630e6ae8d: FAIL: 2 regressions on aarch64 regressions.sum: === gcc tests === Running gcc:gcc.misc-tests/gcov.exp ... FAIL: gcc.misc-tests/gcov-23.c (internal compiler

Re: [PATCH 3/3] Use the term MC/DC in help for gcov --conditions

2024-06-26 Thread Jørgen Kvalsvik
On 6/25/24 12:25, Jan Hubicka wrote: Without key terms like "masking" and "MC/DC" it is not at all obvious what --conditions actually reports on, and there is no easy path for the user to figure out. By at least including the two key terms MC/DC and masking users have something to search for. gc

Re: [PATCH 2/3] Add section on MC/DC in gcov manual

2024-06-26 Thread Jørgen Kvalsvik
On 6/25/24 12:23, Jan Hubicka wrote: gcc/ChangeLog: * doc/gcov.texi: Add MC/DC section. OK, thanks! Pushed. Thanks, Jørgen Honza --- gcc/doc/gcov.texi | 72 +++ 1 file changed, 72 insertions(+) diff --git a/gcc/doc/gcov.texi b/gcc/do

Re: [PATCH 1/3] Release structures on function return

2024-06-26 Thread Jørgen Kvalsvik
On 6/25/24 12:23, Jan Hubicka wrote: The value vec objects are destroyed on exit, but release still needs to be called explicitly. gcc/ChangeLog: * tree-profile.cc (find_conditions): Release vectors before return. I wonder if you turn hash_map, vec> exprs; to hash_m

Re: [PATCH 1/2] Record edge true/false value for gcov

2024-06-26 Thread Jørgen Kvalsvik
On 6/25/24 23:37, Jeff Law wrote: On 6/25/24 2:04 AM, Jørgen Kvalsvik wrote: Make gcov aware which edges are the true/false to more accurately reconstruct the CFG.  There are plenty of bits left in arc_info and it opens up for richer reporting. gcc/ChangeLog: * gcov-io.h (GCOV_ARC_TRUE

Re: [PATCH 3/3] Use the term MC/DC in help for gcov --conditions

2024-06-25 Thread Jørgen Kvalsvik
On 6/25/24 12:25, Jan Hubicka wrote: Without key terms like "masking" and "MC/DC" it is not at all obvious what --conditions actually reports on, and there is no easy path for the user to figure out. By at least including the two key terms MC/DC and masking users have something to search for. gc

Re: [PATCH 1/3] Release structures on function return

2024-06-25 Thread Jørgen Kvalsvik
On 6/25/24 12:23, Jan Hubicka wrote: The value vec objects are destroyed on exit, but release still needs to be called explicitly. gcc/ChangeLog: * tree-profile.cc (find_conditions): Release vectors before return. I wonder if you turn hash_map, vec> exprs; to hash_m

[PATCH 2/2] [RFC] Prime path coverage in gcc/gcov

2024-06-25 Thread Jørgen Kvalsvik
These are the main highlights since v1: 1. The instrumentation phase has been reworked and tries to eliminate redundant instructions. This has a massive impact on performance, taking the compile time of tree.c from 13m30s-14m to ~2m30s on my machine, and the resulting tree.o from ~50M to

[PATCH 1/2] Record edge true/false value for gcov

2024-06-25 Thread Jørgen Kvalsvik
Make gcov aware which edges are the true/false to more accurately reconstruct the CFG. There are plenty of bits left in arc_info and it opens up for richer reporting. gcc/ChangeLog: * gcov-io.h (GCOV_ARC_TRUE): New. (GCOV_ARC_FALSE): New. * gcov.cc (struct arc_info): Add

[PATCH 3/3] Use the term MC/DC in help for gcov --conditions

2024-06-25 Thread Jørgen Kvalsvik
Without key terms like "masking" and "MC/DC" it is not at all obvious what --conditions actually reports on, and there is no easy path for the user to figure out. By at least including the two key terms MC/DC and masking users have something to search for. gcc/ChangeLog: * gcov.cc (print_

[PATCH 2/3] Add section on MC/DC in gcov manual

2024-06-25 Thread Jørgen Kvalsvik
gcc/ChangeLog: * doc/gcov.texi: Add MC/DC section. --- gcc/doc/gcov.texi | 72 +++ 1 file changed, 72 insertions(+) diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi index dc79bccb8cf..a9221738cce 100644 --- a/gcc/doc/gcov.texi +++ b/gcc/doc/g

[PATCH 1/3] Release structures on function return

2024-06-25 Thread Jørgen Kvalsvik
The value vec objects are destroyed on exit, but release still needs to be called explicitly. gcc/ChangeLog: * tree-profile.cc (find_conditions): Release vectors before return. --- gcc/tree-profile.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/tree-profile.cc b/

[PATCH] Add function filtering to gcov

2024-06-25 Thread Jørgen Kvalsvik
Add the --include and --exclude flags to gcov to control what functions to report on. This is meant to make gcov more practical as an when writing test suites or performing other coverage experiments, which tends to focus on a few functions at the time. This really shines in combination with the -t

[PATCH 2/2] Add examples on filteirng in gcov tutorial

2024-06-14 Thread Jørgen Kvalsvik
Add a section with some examples on the --include and --exclude flags in the gcov tutorial. gcc/ChangeLog: * doc/gcov.texi: Add tutorial on function filtering. --- gcc/doc/gcov.texi | 86 +++ 1 file changed, 86 insertions(+) diff --git a/gcc/d

[PATCH 1/2] Add function filtering to gcov

2024-06-14 Thread Jørgen Kvalsvik
Add the --include and --exclude flags to gcov to control what functions to report on. This is meant to make gcov more practical as an when writing test suites or performing other coverage experiments, which tends to focus on a few functions at the time. This really shines in combination with the -t

[PATCH] [RFC] Prime path coverage in gcc/gcov

2024-06-04 Thread Jørgen Kvalsvik
This patch adds prime path coverage to gcc/gcov. It is a bit rough in a few places, but I think all the main components are there and ready for some feedback while I keep working on the details. First a quick introduction to path coverage, before I explain a bit on the pieces of the patch and on wh

[PATCH] Record edge true/false value for gcov

2024-06-04 Thread Jørgen Kvalsvik
Make gcov aware which edges are the true/false to more accurately reconstruct the CFG. There are plenty of bits left in arc_info and it opens up for richer reporting. gcc/ChangeLog: * gcov-io.h (GCOV_ARC_TRUE): New. (GCOV_ARC_FALSE): New. * gcov.cc (struct arc_info): Add

Re: [PATCH] [RFC] Add function filtering to gcov

2024-05-08 Thread Jørgen Kvalsvik
On 5/8/24 15:29, Richard Biener wrote: On Fri, Mar 29, 2024 at 8:02 PM Jørgen Kvalsvik wrote: This is a prototype for --include/--exclude flags, and I would like a review of both the approach and architecture, and the implementation, plus feedback on the feature itself. I did not update the

[PATCH] Guard longjmp in test to not inf loop [PR114720]

2024-04-15 Thread Jørgen Kvalsvik
Guard the longjmp to not infinitely loop. The longjmp (jump) function is called unconditionally to make test flow simpler, but the jump destination would return to a point in main that would call longjmp again. The longjmp is really there to exercise the then-branch of setjmp, to verify coverage is

Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-15 Thread Jørgen Kvalsvik
On 15/04/2024 13:18, Rainer Orth wrote: Hi Jørgen, the new gcc.misc-tests/gcov-22.c test loops on SPARC (both Solaris and Linux). I've filed PR gcov-profile/114720 for this, but couldn't find any bugzilla account of yours to Cc: Rainer Rainer, Could you please try this patch? I don

Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-15 Thread Jørgen Kvalsvik
On 15/04/2024 10:53, Rainer Orth wrote: Hi Jørgen, On 04/04/2024 14:10, Jan Hubicka wrote: gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: A

Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-15 Thread Jørgen Kvalsvik
On 15/04/2024 10:53, Rainer Orth wrote: Hi Jørgen, On 04/04/2024 14:10, Jan Hubicka wrote: gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: A

Re: [PATCH] Guard function->cond_uids access [PR114601]

2024-04-09 Thread Jørgen Kvalsvik
On 09/04/2024 13:43, Jørgen Kvalsvik wrote: PR114601 shows that it is possible to reach the condition_uid lookup without having also created the fn->cond_uids, through compiler-generated conditionals. Consider all lookups on non-existing maps misses, which they are from the perspective of

[PATCH] Guard function->cond_uids access [PR114601]

2024-04-09 Thread Jørgen Kvalsvik
PR114601 shows that it is possible to reach the condition_uid lookup without having also created the fn->cond_uids, through compiler-generated conditionals. Consider all lookups on non-existing maps misses, which they are from the perspective of the source code, to avoid the NULL access. P

Re: [PATCH 2/2] Generate constant at start of loop, without UB

2024-04-09 Thread Jørgen Kvalsvik
On 09/04/2024 09:40, Richard Biener wrote: On Mon, 8 Apr 2024, Jørgen Kvalsvik wrote: Generating the constants used for recording the edges taken for condition coverage would trigger undefined behavior when an expression had exactly 64 (== sizeof (1ULL)) conditions, as it would generate the

[PATCH 0/2] More condition coverage fixes

2024-04-08 Thread Jørgen Kvalsvik
(sizeof uint64_t), by slightly restructuring the loop generating constants. This passes check-gcc RUNTESTFLAGS=gcov.exp in my ubsan instrumented build: configure --enable-languages=c,c++ --enable-host-shared --enable-checking=release --disable-multilib --with-build-config=bootstrap-ubsan Jørgen

[PATCH 2/2] Generate constant at start of loop, without UB

2024-04-08 Thread Jørgen Kvalsvik
Generating the constants used for recording the edges taken for condition coverage would trigger undefined behavior when an expression had exactly 64 (== sizeof (1ULL)) conditions, as it would generate the constant for the next iteration at the end of the loop body, even if there was never a next i

[PATCH 1/2] Add tree-inlined gconds to caller cond->expr map

2024-04-08 Thread Jørgen Kvalsvik
Properly add the condition -> expression mapping of inlined gconds from the caller into the callee map. This is a fix for PR114599 that works beyond fixing the segfault, as the previous fixed copied references to the source gconds, not the deep copied ones that end up in the calle body. The new te

Re: [PATCH 0/2] Condition coverage fixes

2024-04-07 Thread Jørgen Kvalsvik
On 07/04/2024 08:26, Richard Biener wrote: Am 06.04.2024 um 22:41 schrieb Jørgen Kvalsvik : On 06/04/2024 13:15, Jørgen Kvalsvik wrote: On 06/04/2024 07:50, Richard Biener wrote: Am 05.04.2024 um 21:59 schrieb Jørgen Kvalsvik : Hi, I propose these fixes for the current issues with

Re: [PATCH 0/2] Condition coverage fixes

2024-04-06 Thread Jørgen Kvalsvik
On 06/04/2024 13:15, Jørgen Kvalsvik wrote: On 06/04/2024 07:50, Richard Biener wrote: Am 05.04.2024 um 21:59 schrieb Jørgen Kvalsvik : Hi, I propose these fixes for the current issues with the condition coverage. Rainer, I propose to simply delete the test with __sigsetjmp. I don&#

Re: [PATCH 0/2] Condition coverage fixes

2024-04-06 Thread Jørgen Kvalsvik
On 06/04/2024 07:50, Richard Biener wrote: Am 05.04.2024 um 21:59 schrieb Jørgen Kvalsvik : Hi, I propose these fixes for the current issues with the condition coverage. Rainer, I propose to simply delete the test with __sigsetjmp. I don't think it actually detects anything reasonabl

[PATCH 1/2] Remove unecessary and broken MC/DC compile test

2024-04-05 Thread Jørgen Kvalsvik
The __sigsetjmp test was added as a regression test, which an early iteration of the MC/DC support caused an internal compiler error, triggered by a code path which did not make it through to the final revision. Since this test really only worked on linux and does not serve a purpose any more it c

[PATCH 2/2] Copy condition->expr map when inlining [PR114599]

2024-04-05 Thread Jørgen Kvalsvik
When a function is tree-inlined, copy the condition -> expression mapping from the inlined function into the caller, shifted so uids are not mixed Tree inlining was always problematic under condition coverage - either through a nullptr dereference (like in the test case), or through quietly mixing

[PATCH 0/2] Condition coverage fixes

2024-04-05 Thread Jørgen Kvalsvik
2 and trigger the error. [1] https://gcc.gnu.org/pipermail/gcc-patches/2024-April/648785.html Thanks, Jørgen Jørgen Kvalsvik (2): Remove unecessary and broken MC/DC compile test Copy condition->expr map when inlining [PR114599] gcc/testsuite/gcc.misc-tests/gcov-19.c | 11 --

Re: [PATCH] middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes

2024-04-05 Thread Jørgen Kvalsvik
On 05/04/2024 16:05, H.J. Lu wrote: On Fri, Apr 5, 2024 at 6:52 AM Richard Biener wrote: Am 05.04.2024 um 15:46 schrieb H.J. Lu : On Fri, Apr 5, 2024 at 1:21 AM Richard Biener wrote: There's no default bitmap obstack during global CTORs, so allocate the bitmap locally. Bootstrap and r

Re: [PATCH] middle-end/114599 - fix bitmap allocation for check_ifunc_callee_symtab_nodes

2024-04-05 Thread Jørgen Kvalsvik
On 05/04/2024 16:05, H.J. Lu wrote: On Fri, Apr 5, 2024 at 6:52 AM Richard Biener wrote: Am 05.04.2024 um 15:46 schrieb H.J. Lu : On Fri, Apr 5, 2024 at 1:21 AM Richard Biener wrote: There's no default bitmap obstack during global CTORs, so allocate the bitmap locally. Bootstrap and r

Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-05 Thread Jørgen Kvalsvik
On 05/04/2024 15:00, Rainer Orth wrote: Hi Jørgen, On 04/04/2024 14:10, Jan Hubicka wrote: gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: A

Re: [PATCH v10 1/2] Add condition coverage (MC/DC)

2024-04-04 Thread Jørgen Kvalsvik
On 04/04/2024 14:10, Jan Hubicka wrote: gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: Add new options -fcondition-coverage and -Wco

[PATCH] [RFC] Add function filtering to gcov

2024-03-29 Thread Jørgen Kvalsvik
This is a prototype for --include/--exclude flags, and I would like a review of both the approach and architecture, and the implementation, plus feedback on the feature itself. I did not update the manuals or carefully extend --help, in case the interface itself needs some revision before it can be

[PATCH] Output branches and calls in gcov function summaries

2024-02-27 Thread Jørgen Kvalsvik
The gcov function summaries only output the covered lines, not the branches and calls. Since the function summaries is an opt-in it probably makes sense to also include branch coverage. Simply adds the branch- and call information to the function-summaries output. $ gcc --coverage hello.c -o hello

[PATCH v10 2/2] Add gcov MC/DC tests for GDC

2024-02-23 Thread Jørgen Kvalsvik
This is a mostly straight port from the gcov-19.c tests from the C test suite. The only notable differences from C to D are that D flips the true/false outcomes for loop headers, and the D front end ties loop and ternary conditions to slightly different locus. The test for >64 conditions warning i

Re: [PATCH v9 1/2] Add condition coverage (MC/DC)

2024-02-22 Thread Jørgen Kvalsvik
On 22/02/2024 14:26, Jan Hubicka wrote: Hello, This patch adds support in gcc+gcov for modified condition/decision coverage (MC/DC) with the -fcondition-coverage flag. MC/DC is a type of test/code coverage and it is particularly important for safety-critical applicaitons in industries like aviat

[PATCH v9 2/2] Add gcov MC/DC tests for GDC

2023-12-31 Thread Jørgen Kvalsvik
This is a mostly straight port from the gcov-19.c tests from the C test suite. The only notable differences from C to D are that D flips the true/false outcomes for loop headers, and the D front end ties loop and ternary conditions to slightly different locus. The test for >64 conditions warning i

Re: [PATCH v7] Add condition coverage (MC/DC)

2023-12-31 Thread Jørgen Kvalsvik
On 31/12/2023 10:40, Jan Hubicka wrote: This seems good. Profile-arcs is rarely used by itself - most of time it is implied by -fprofile-generate and -ftest-coverage and since condition coverage is more associated to the second, I guess -fcondition-coverage is better name. Since -fcondition-cove

Re: [PATCH v7] Add condition coverage (MC/DC)

2023-12-29 Thread Jørgen Kvalsvik
On 29/12/2023 22:14, Jan Hubicka wrote: gcc/ChangeLog: * builtins.cc (expand_builtin_fork_or_exec): Check condition_coverage_flag. * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. * common.opt: Add new options -fcondition-coverage and -Wco

  1   2   >