Skip to content

Too long compile time with some array size #106211

Closed
@dalance

Description

@dalance

I changed array size of the following line.

https://github.com/dalance/veryl/blob/eff1afcbdca883e6938d232852e3f10944001682/crates/formatter/src/aligner.rs#L105

Some values cause compiler hang in release mode.
In debug mode, all value is OK.

For example,

aligns: [Align; 1], // OK
aligns: [Align; 2], // NG
aligns: [Align; 3], // OK
aligns: [Align; 4], // OK

In 1..20, 2 and 6 to 12 is NG. The others is OK.
I tried to change the array to Vec. It is NG.

aligns: Vec<Align>,

I couldn't reduce the testcase size.
So I write the reproduce procedure.

$ git clone https://github.com/dalance/veryl
$ git checkout eff1afcbdca883e6938d232852e3f10944001682
$ cargo build --release  # OK
$ sed -i 's/Align; 5/Align; 2/g' crates/formatter/src/aligner.rs
$ cargo build --release  # NG

Meta

rustc --version --verbose:

rustc 1.66.0 (69f9c33d7 2022-12-12)
binary: rustc
commit-hash: 69f9c33d71c871fc16ac445211281c6e7a340943
commit-date: 2022-12-12
host: x86_64-unknown-linux-gnu
release: 1.66.0
LLVM version: 15.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-LTOArea: Link-time optimization (LTO)A-arrayArea: `[T; N]`C-bugCategory: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions