Skip to content

Commit d306053

Browse files
committed
result as allocatable to silence flang
1 parent f0cb40f commit d306053

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/generator/op_generator.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module op_generator_m
1616
type(op_generator_t_arg_t), allocatable :: args(:)
1717
type(argument_match_t), allocatable :: arg_match(:)
1818
class(operation_t), allocatable :: op
19-
type(value_item_t) :: result
19+
type(value_item_t), allocatable :: result
2020
contains
2121
procedure :: yield
2222
procedure :: yield_ref
@@ -66,6 +66,7 @@ recursive subroutine yield_ref(gen, ref, err)
6666
type(value_ref_t), intent(out) :: ref
6767
type(err_t), intent(inout), optional :: err
6868

69+
if (.not. allocated(gen % result)) allocate(gen % result)
6970
call yield(gen, gen % result % value, err)
7071
if (check(err)) return
7172

@@ -100,7 +101,7 @@ recursive function trace(gen)
100101
impure elemental subroutine cleanup(gen)
101102
class(op_generator_t), intent(inout) :: gen
102103

103-
if (allocated(gen % result % value)) deallocate(gen % result % value)
104+
if (allocated(gen % result)) deallocate(gen % result)
104105
end subroutine
105106

106107
end module

0 commit comments

Comments
 (0)