gpt4 book ai didi

c - gcc 警告 "coverage_mismatch"是什么意思?

转载 作者:行者123 更新时间:2023-12-03 23:09:59 35 4
gpt4 key购买 nike

今天遇到一个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 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]);

最佳答案

请参阅 Warning options 上的 GCC (9.2.0) 手册:

-Wno-coverage-mismatch

Warn if feedback profiles do not match when using the -fprofile-use option. If a source file is changed between compiling with -fprofile-generate and with -fprofile-use, the files with the profile feedback can fail to match the source file and GCC cannot use the profile feedback information. By default, this warning is enabled and is treated as an error. -Wno-coverage-mismatch can be used to disable the warning or -Wno-error=coverage-mismatch can be used to disable the error. Disabling the error for this warning can result in poorly optimized code and is useful only in the case of very minor changes such as bug fixes to an existing code-base. Completely disabling the warning is not recommended.


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

关于c - gcc 警告 "coverage_mismatch"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59259069/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com