Skip to content

Crash when compiling VLA-type compound literal. #89835

@tstanisl

Description

@tstanisl

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 .

Metadata

Metadata

Assignees

Labels

accepts-invalidc99clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partygood first issuehttps://github.com/llvm/llvm-project/contribute

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions