[flang] [llvm] [flang] Check allocation status in inlined ALLOCATE lowering (PR #223287)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 27 23:31:34 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Linux-->
# :penguin: Linux x64 Test Results

* 4997 tests passed
* 142 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### Flang
<details>
<summary>Flang.Lower/allocatables.f90</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/bbc -fintrinsic-modules-path=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/finclude/flang/x86_64-unknown-linux-gnu -emit-hlfir /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/allocatables.f90 -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/allocatables.f90
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/bbc -fintrinsic-modules-path=/home/gha/actions-runner/_work/llvm-project/llvm-project/build/lib/clang/24/finclude/flang/x86_64-unknown-linux-gnu -emit-hlfir /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/allocatables.f90 -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/allocatables.f90
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/allocatables.f90:84:11: error: CHECK: expected string not found in input
# |  ! CHECK: %[[alloc:.*]] = fir.allocmem !fir.char<1,?>(%[[c10]] : index) {{{.*}}uniq_name = "_QFchar_deferredEc.alloc"}
# |           ^
# | <stdin>:156:45: note: scanning from here
# |  %10 = fir.convert %c10_i32 : (i32) -> index
# |                                             ^
# | <stdin>:156:45: note: with "c10" equal to "10"
# |  %10 = fir.convert %c10_i32 : (i32) -> index
# |                                             ^
# | <stdin>:156:45: note: pattern attempts to capture variables: "alloc"
# |  %10 = fir.convert %c10_i32 : (i32) -> index
# |                                             ^
# | <stdin>:157:2: note: possible intended match here
# |  %11 = fir.allocmem !fir.char<1,?>(%10 : index) <{uniq_name = "_QFchar_deferredEc.alloc"}> {fir.must_be_heap = true}
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/flang/test/Lower/allocatables.f90
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |           151:  %7 = fir.box_addr %6 : (!fir.box<!fir.heap<!fir.char<1,?>>>) -> !fir.heap<!fir.char<1,?>> 
# |           152:  %8 = fir.convert %7 : (!fir.heap<!fir.char<1,?>>) -> i64 
# |           153:  %c0_i64 = arith.constant 0 : i64 
# |           154:  %9 = arith.cmpi eq, %8, %c0_i64 : i64 
# |           155:  fir.assert %9, "The object 'c' is already allocated" 
# |           156:  %10 = fir.convert %c10_i32 : (i32) -> index 
# | check:84'0                                                {   search range start (exclusive)
# | check:84'1                                                    error: no match found in search range
# | check:84'2                                                    with "c10" equal to "10"
# | check:84'3                                                    pattern attempts to capture variables: "alloc"
# |           157:  %11 = fir.allocmem !fir.char<1,?>(%10 : index) <{uniq_name = "_QFchar_deferredEc.alloc"}> {fir.must_be_heap = true} 
# | check:84'4      ?                                                                                                                     possible intended match
# |           158:  %12 = fir.embox %11 typeparams %10 : (!fir.heap<!fir.char<1,?>>, index) -> !fir.box<!fir.heap<!fir.char<1,?>>> 
# |           159:  fir.store %12 to %4#0 : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>> 
# |           160:  %13 = fir.load %4#0 : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>> 
# |           161:  %14 = fir.box_addr %13 : (!fir.box<!fir.heap<!fir.char<1,?>>>) -> !fir.heap<!fir.char<1,?>> 
# |           162:  fir.freemem %14 : !fir.heap<!fir.char<1,?>> 
# |             .
# |             .
# |             .
# |           198:  %39 = fir.embox %38 typeparams %c0_3 : (!fir.heap<!fir.char<1,?>>, index) -> !fir.box<!fir.heap<!fir.char<1,?>>> 
# |           199:  fir.store %39 to %4#0 : !fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>> 
# |           200:  } 
# |           201:  return 
# |           202:  } 
# |           203:  func.func @_QPchar_explicit_cst(%arg0: !fir.ref<i32> {fir.bindc_name = "n"}) { 
# | check:84'5                                      }                                                search range end (exclusive)
# |           204:  %0 = fir.dummy_scope : !fir.dscope 
# |           205:  %1 = fir.alloca !fir.box<!fir.heap<!fir.char<1,10>>> <{bindc_name = "c", uniq_name = "_QFchar_explicit_cstEc"}> 
# |           206:  %c10 = arith.constant 10 : index 
# |           207:  %2 = fir.zero_bits !fir.heap<!fir.char<1,10>> 
# |           208:  %3 = fir.embox %2 : (!fir.heap<!fir.char<1,10>>) -> !fir.box<!fir.heap<!fir.char<1,10>>> 
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

https://github.com/llvm/llvm-project/pull/223287


More information about the llvm-commits mailing list