Open
Description
The following repo/hash compiles with rustc v1.58, but loops forever in v1.59 and Nightly (1.61): sstangl/openpowerlifting@ac057e3
The problem appears to be with the compilation of a very small crate (modules/langpack
) that uses include_str!
to include some JSON files. The problematic method is the implementation of default()
:
fn default() -> LangInfo {
LangInfo {
cz: json::from_str(include_str!("../translations/cz.json")).expect("cz"),
de: json::from_str(include_str!("../translations/de.json")).expect("de"),
el: json::from_str(include_str!("../translations/el.json")).expect("el"),
en: json::from_str(include_str!("../translations/en.json")).expect("en"),
eo: json::from_str(include_str!("../translations/eo.json")).expect("eo"),
es: json::from_str(include_str!("../translations/es.json")).expect("es"),
fi: json::from_str(include_str!("../translations/fi.json")).expect("fi"),
fr: json::from_str(include_str!("../translations/fr.json")).expect("fr"),
hr: json::from_str(include_str!("../translations/hr.json")).expect("hr"),
hu: json::from_str(include_str!("../translations/hu.json")).expect("hu"),
it: json::from_str(include_str!("../translations/it.json")).expect("it"),
ja: json::from_str(include_str!("../translations/ja.json")).expect("ja"),
ko: json::from_str(include_str!("../translations/ko.json")).expect("ko"),
lt: json::from_str(include_str!("../translations/lt.json")).expect("lt"),
nl: json::from_str(include_str!("../translations/nl.json")).expect("nl"),
pl: json::from_str(include_str!("../translations/pl.json")).expect("pl"),
pt: json::from_str(include_str!("../translations/pt.json")).expect("pt"),
sk: json::from_str(include_str!("../translations/sk.json")).expect("sk"),
sl: json::from_str(include_str!("../translations/sl.json")).expect("sl"),
sr: json::from_str(include_str!("../translations/sr.json")).expect("sr"),
sv: json::from_str(include_str!("../translations/sv.json")).expect("sv"),
ru: json::from_str(include_str!("../translations/ru.json")).expect("ru"),
tr: json::from_str(include_str!("../translations/tr.json")).expect("tr"),
uk: json::from_str(include_str!("../translations/uk.json")).expect("uk"),
vi: json::from_str(include_str!("../translations/vi.json")).expect("vi"),
zh_hant: json::from_str(include_str!("../translations/zh-Hant.json")).expect("zh_hant"),
zh_hans: json::from_str(include_str!("../translations/zh-Hans.json")).expect("zh_hans"),
}
}
When this function is removed, compilation succeeds.
GDB shows a thread stuck within LLVM, doing various optimizations, in a seemingly-endless loop (I waited several minutes. Previously this compilation with 1.58.1 took ~32s):
6 Thread 0x7f6b9fbff640 (LWP 171415) "LTO langpack.a3" 0x00007f6bbeb4cd3f in llvm::SSAUpdater::GetValueAtEndOfBlockInternal(llvm::BasicBlock*) ()
5 Thread 0x7f6ba03ff640 (LWP 171218) "opt langpack.a3" 0x00007f6bbe3f34cf in llvm::removeUnreachableBlocks(llvm::Function&, llvm::DomTreeUpdater*, llvm::MemorySSAUpdater*) ()
5 Thread 0x7fa58c3ff640 (LWP 170073) "opt langpack.a3" 0x00007fa5aa4f21e4 in llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&, llvm::ArrayRef<llvm::WeakVH>) ()
Steps to Reproduce
git clone https://github.com/sstangl/openpowerlifting.git
git checkout ac057e388ac911fda2e93acd8689d13f6df23034
cd modules/langpack
cargo build
Meta
rustc --version --verbose
:
rustc 1.59.0 (9d1b2106e 2022-02-23)
binary: rustc
commit-hash: 9d1b2106e23b1abd32fce1f17267604a5102f57a
commit-date: 2022-02-23
host: x86_64-unknown-linux-gnu
release: 1.59.0
LLVM version: 13.0.0
The problem also exists with Nightly:
rustc 1.61.0-nightly (4b043faba 2022-02-24)
binary: rustc
commit-hash: 4b043faba34ccc053a4d0110634c323f6c03765e
commit-date: 2022-02-24
host: x86_64-unknown-linux-gnu
release: 1.61.0-nightly
LLVM version: 14.0.0