5

今天我Werror=Wcoverage_mismatch在编译一些erlang/opt时遇到一个错误:

beam/beam_emu.c: In function 'erts_current_reductions':                                                     
beam/beam_emu.c:3150:1: error: the control flow of function 'erts_current_reductions' does not match its profile data (counter 'arcs') [-Werror=coverage-mismatch]             
 } 
...

但我不知道这是什么意思,谷歌没有告诉我这个标志。下面是gcc源代码

if (entry->n_counts != n_counts)
      warning_printed = warning_at(
          DECL_SOURCE_LOCATION(current_function_decl), OPT_Wcoverage_mismatch,
          "number of counters in profile data for function %qD "
          "does not match "
          "its profile data (counter %qs, expected %i and have %i)",
          current_function_decl, ctr_names[counter], entry->n_counts, n_counts);
    else
      warning_printed = warning_at(
          DECL_SOURCE_LOCATION(current_function_decl), OPT_Wcoverage_mismatch,
          "the control flow of function %qD does not match "
          "its profile data (counter %qs)",
          current_function_decl, ctr_names[counter]);
4

1 回答 1

6

请参阅有关警告选项的 GCC (9.2.0) 手册:

-Wno-coverage-mismatch

-fprofile-use如果使用该选项时反馈配置文件不匹配,则会发出警告。-fprofile-generate如果源文件在 compile with和 with之间发生变化,-fprofile-use带有 profile 反馈的文件可能无法匹配源文件,并且 GCC 无法使用 profile 反馈信息。默认情况下,此警告已启用并被视为错误。-Wno-coverage-mismatch可用于禁用警告或-Wno-error=coverage-mismatch可用于禁用错误。禁用此警告的错误可能会导致代码优化不佳,并且仅在非常小的更改(例如对现有代码库的错误修复)的情况下才有用。不建议完全禁用警告。

因此,您的源代码似乎自编译以来已更改,这可能会导致问题(因此出现错误消息)。重新编译并重新运行分析。

于 2019-12-10T05:04:09.933 回答