EOF*_*EOF 14 c gcc internal-compiler-error
我试着编译以下函数来看看gcc是怎么做的:
#include <stdint.h>
#include <stddef.h>
typedef struct giga
{
uint64_t g[0x10000000];
} giga;
uint64_t addfst(giga const *gptr, size_t num)
{
uint64_t retval = 0;
for (size_t i = 0; i < num; i++)
{
retval += gptr[i].g[0];
}
return retval;
}
Run Code Online (Sandbox Code Playgroud)
并且发现gcc最大化了我的记忆,将自己交换死亡.
我发现在优化时会发生这种情况-O3,并未尝试剖析确切的标志.在gcc.godbolt上测试函数显示这是gcc特定的,但是受到了4.8和4.9版本的影响.
这是一个真正的编译器错误,还是我的功能坏了?
该错误位于 gcc bugzilla 上,https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65518。它已被确认并显然已固定在行李箱中。希望修复最终能渗透到我的发行版中。感谢大家!