https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118607
Bug ID: 118607 Summary: gcov-tool merge weights must be integers, while help command suggest users to use floats Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: gigor-ads at yandex dot ru Target Milestone: --- Hello! I have tried to set weights, and as I saw, gcov-merge suggests to use floats as weights: merge [options] <dir1> <dir2> Merge coverage file contents -o, --output <dir> Output directory -v, --verbose Verbose mode -w, --weight <w1,w2> Set weights (float point values) That comes from lines: https://github.com/gcc-mirror/gcc/blob/8c93a8aa67f12c8e03eb7fd90f671a03ae46935b/gcc/gcov-tool.cc#L164-L173 However, in gcov-tool implementation, the weights are integers: https://github.com/gcc-mirror/gcc/blob/8c93a8aa67f12c8e03eb7fd90f671a03ae46935b/gcc/gcov-tool.cc#L200 https://github.com/gcc-mirror/gcc/blob/8c93a8aa67f12c8e03eb7fd90f671a03ae46935b/gcc/gcov-tool.cc#L215 So, floating point values, which are entered by users, are not proper and integer values must be used. The patch is simple: diff --git a/gcc/gcov-tool.cc b/gcc/gcov-tool.cc index d8f2790b110..dceb8af03ad 100644 --- a/gcc/gcov-tool.cc +++ b/gcc/gcov-tool.cc @@ -169,7 +169,7 @@ print_merge_usage_message (int error_p) fnotice (file, " merge [options] <dir1> <dir2> Merge coverage file contents\n"); fnotice (file, " -o, --output <dir> Output directory\n"); fnotice (file, " -v, --verbose Verbose mode\n"); - fnotice (file, " -w, --weight <w1,w2> Set weights (float point values)\n"); + fnotice (file, " -w, --weight <w1,w2> Set weights (integer values)\n"); } static const struct option merge_options[] = @@ -240,7 +240,7 @@ print_merge_stream_usage_message (int error_p) fnotice (file, " merge-stream [options] [<file>] Merge coverage stream file (or stdin)\n" " and coverage file contents\n"); fnotice (file, " -v, --verbose Verbose mode\n"); - fnotice (file, " -w, --weight <w1,w2> Set weights (float point values)\n"); + fnotice (file, " -w, --weight <w1,w2> Set weights (integer values)\n"); } static const struct option merge_stream_options[] =