llvm / llvm/llvm-project

[flang] assertion failure CHECK(!details->init()) failed at flang/lib/Semantics/resolve-names.cpp

Open
#209,980 3 comments 0 reactions 0 assignees View on GitHub
crash flang:frontend generated by fuzzer
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/qfs6oaerr

The following code:

```fortran
parameter(i=1)
integer, pointer :: I => t
end
```

Resulted in this output:
```
fatal internal error: CHECK(!details->init()) failed at flang/lib/Semantics/resolve-names.cpp(9155)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /usr/lib/llvm-22/bin/flang -fc1 -triple x86_64-pc-linux-gnu -emit-obj -ffree-form -fdefault-integer-8 -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -vectorize-loops -vectorize-slp -fversion-loops-for-stride -finit-global-zero -std=f2018 -resource-dir /usr/lib/llvm-22/lib/clang/22 -mframe-pointer=none -O3 -o /tmp/test-cb0fb8.o -x f95 /tmp/test.f90
#0 0x00007f41555fdd5f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-22/lib/libLLVM.so.22.1+0x4dc7d5f)
#1 0x00007f41555fb5d7 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-22/lib/libLLVM.so.22.1+0x4dc55d7)
#2 0x00007f41555feb2a (/usr/lib/llvm-22/lib/libLLVM.so.22.1+0x4dc8b2a)
#3 0x00007f41502d2330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007f415032bb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
#5 0x00007f41502d227e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#6 0x00007f41502b58ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#7 0x0000555e9f52961c (/usr/lib/llvm-22/bin/flang+0x2b2061c)
#8 0x0000555e9dd8e85b Fortran::semantics::DeclarationVisitor::PointerInitialization(Fortran::parser::Name const&, Fortran::common::Indirection const&) (/usr/lib/llvm-22/bin/flang+0x138585b)
#9 0x0000555e9dde2563 (/usr/lib/llvm-22/bin/flang+0x13d9563)
#10 0x0000555e9dde2037 (/usr/lib/llvm-22/bin/flang+0x13d9037)
#11 0x0000555e9ddd88f7 (/usr/lib/llvm-22/bin/flang+0x13cf8f7)
#12 0x0000555e9dd95121 Fortran::semantics::ResolveNamesVisitor::FinishSpecificationParts(Fortran::semantics::ProgramTree const&) (/usr/lib/llvm-22/bin/flang+0x138c121)
#13 0x0000555e9dd94994 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/usr/lib/llvm-22/bin/flang+0x138b994)
#14 0x0000555e9dde3dd8 (/usr/lib/llvm-22/bin/flang+0x13dadd8)
#15 0x0000555e9dd96b33 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/usr/lib/llvm-22/bin/flang+0x138db33)
#16 0x0000555e9de8400f Fortran::semantics::Semantics::Perform() (/usr/lib/llvm-22/bin/flang+0x147b00f)
#17 0x0000555e9d5d391e Fortran::frontend::FrontendAction::runSemanticChecks() (/usr/lib/llvm-22/bin/flang+0xbca91e)
#18 0x0000555e9d5d87da Fortran::frontend::CodeGenAction::beginSourceFileAction() (/usr/lib/llvm-22/bin/flang+0xbcf7da)
#19 0x0000555e9d5d2f9e Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/usr/lib/llvm-22/bin/flang+0xbc9f9e)
#20 0x0000555e9d5bae7f Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/usr/lib/llvm-22/bin/flang+0xbb1e7f)
#21 0x0000555e9d5d7ba0 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/usr/lib/llvm-22/bin/flang+0xbceba0)
#22 0x0000555e9d5b8d34 fc1_main(llvm::ArrayRef, char const*) (/usr/lib/llvm-22/bin/flang+0xbafd34)
#23 0x0000555e9d5b7fa4 main (/usr/lib/llvm-22/bin/flang+0xbaefa4)
#24 0x00007f41502b71ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#25 0x00007f41502b728b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#26 0x0000555e9d5b6f45 _start (/usr/lib/llvm-22/bin/flang+0xbadf45)
flang-22: error: unable to execute command: Aborted (core dumped)
flang-22: error: flang frontend command failed due to signal (use -v to see invocation)
Ubuntu flang version 22.1.8 (++20260613092238+e80beda6e255-1~exp1~20260613092253.78)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-22/bin
flang-22: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-22: note: diagnostic msg: /tmp/test-ef5212
flang-22: note: diagnostic msg: /tmp/test-ef5212.sh
flang-22: note: diagnostic msg:

********************
```

To reproduce:
```
flang ./test.f90
```

Compiler version:
```
Ubuntu flang version 22.1.8 (++20260613092238+e80beda6e255-1~exp1~20260613092253.78)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-22/bin
```

*This bug was found by [fusion-fuzz](https://github.com/fusion-fuzz/fusion-fuzz)*

Contributor guide

Open the contributing guide

Research direction

Start by running the provided test.f90 reproducer with flang, then inspect PointerInitialization in flang/lib/Semantics/resolve-names.cpp around the assertion at line 9155. Determine how this parameter and pointer initialization reaches the failing check. Done means the input no longer aborts with the assertion and regression coverage verifies the corrected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.