今天,我在编译某些erlang/opt时遇到Werror=Wcoverage_mismatch
错误:
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 source code
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]);
答案 0 :(得分:2)
请参见Warning options上的GCC(9.2.0)手册:
-Wno-coverage-mismatch
使用
-fprofile-use
选项时,如果反馈配置文件不匹配,请进行警告。如果在使用-fprofile-generate
和-fprofile-use
进行编译之间更改了源文件,则具有配置文件反馈的文件可能无法与源文件匹配,并且GCC无法使用配置文件反馈信息。默认情况下,此警告处于启用状态,并被视为错误。-Wno-coverage-mismatch
可用于禁用警告,或者-Wno-error=coverage-mismatch
可用于禁用错误。禁用此警告的错误可能会导致代码优化欠佳,并且仅在非常小的更改(例如对现有代码库的错误修复)中有用。不建议完全禁用该警告。
因此,看来您的源代码自编译以来就发生了更改,这很可能会引起问题(因此出现错误消息)。重新编译并重新运行分析。