Crash when compiling VLA-type compound literal. (original) (raw)
The execution of a program compiled from the following code crashes:
#include <stdio.h>
int main() {
int size = 5;
(void)(int[size]) {};
}
Options: -std=c2x -Wall -pedantic
Godbold: https://godbolt.org/z/84d13Tqve
Related:
int main() {
int size = 5;
(void)(int[size]) {};
return size;
}
Returns incorrect 0 when compiling with no optimization (-O0), but works fine with higher optimization levels.
See https://godbolt.org/z/M9xeeo5qa vs https://godbolt.org/z/soahEGrjx .