Issue |
117713
|
Summary |
SIGSEGV on x86-64 platform with clang-trunk when compiling the program with very-large function parameter without optimization
|
Labels |
new issue
|
Assignees |
|
Reporter |
wangbo15
|
On the `x86-64` platform, the following code gets a `SIGSEGV` when compiled with `clang-trunk` without any option.
However, if optimization is enabled (e.g., `-O1`, the program executes and exits normally.
The same code compiles and runs correctly with GCC without any optimization flags. Interestingly, if the size of `a5` is reduced from `38000` to `37000`, the program occasionally runs successfully with clang-trunk.
Here is the minimal reproducer, also in gotblot: https://godbolt.org/z/jz4hj9Pco
```cpp
class type_2 {
int a1[252525];
int a2[252525];
int a3[252525];
int a4[252525];
int a5[38000]; // if change to a5[37000], the program can randomly pass.
} object;
void test(type_2) {}
int main() {
test(object);
}
```
The `ulimit` of my computer is as follows, where the stack size is `8M`, larger than the `object` (which is about `4.19 MB`) :
```
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 642079
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 642079
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs