#include<bits/stdc++.h>
using namespace std;
const int N=1e6;
struct {
int a=INT_MAX,b=INT_MIN;
} c[N];
int main(){
c[0].a=1;
return 0;
}
如上代码,在 luogu C++14(GCC 9) 上无法编译,但是本地及其他 oj 均可行。 luogu 编译输出:
Nothing is compiled: OUTPUT exceeds.
本地测试: 环境 Ubuntu 23.04
╭─ /tmp 17:51:41
╰─❯ cat tmp.cpp
#include<bits/stdc++.h>
using namespace std;
const int N=1e6;
struct node{
int maxn=INT_MIN,
minn=INT_MAX;
}c[N];
int main(){
return 0;
}
╭─ /tmp 17:51:43
╰─❯ time g++-9 tmp.cpp -o tmp -DONLINE_JUDGE -Wall -fno-asm -lm -march=native
g++-9 tmp.cpp -o tmp -DONLINE_JUDGE -Wall -fno-asm -lm -march=native 1.56s user 0.19s system 99% cpu 1.764 total
╭─ /tmp 17:51:46
╰─❯ du -h tmp
7.7M tmp
另外,这份代码还在 一个 nix docker 按照 https://github.com/luogu-dev/judge-env 生成的 g++ 中测试过,环境应与 luogu 评测环境相同。他一样可以通过编译。
#include<bits/stdc++.h>
using namespace std;
const int N=1e6;
struct {
int a=INT_MAX,b=INT_MIN;
} c[N];
int main(){
c[0].a=1;
return 0;
}
这份代码在本地测得大小为 7.7MB,与有问题的代码占用相同。而他可以正常编译运行。另外,可执行文件过大导致的错误,报错信息应该为:
g++: 编译器内部错误:File size limit exceeded signal terminated program as
请提交一份完整的错误报告,
如有可能请附上经预处理后的源文件。
参阅 <https://gcc.gnu.org/bugs/> 以获取指示。
那么还能是什么原因导致的如此返回结果?求懂哥或开发组解答。