Files
clang-p2996/flang/test/Lower/memory-alloc.f90
Valentin Clement 411f839ae3 [flang] Fix for array upper bounds with *
Even though the array is declared with '*' upper bounds, it has an
initial value that has a statically known shape. Use the shape from
the type of the initializer when the declared size is '*'.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128889

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2022-06-30 10:37:22 +02:00

20 lines
611 B
Fortran

! RUN: bbc -o - %s | FileCheck %s
! CHECK-LABEL: func @_QMw0bPtest1(
! CHECK: %[[TWO:.*]] = arith.constant 2 : index
! CHECK: %[[HEAP:.*]] = fir.allocmem !fir.array<?x!fir.logical<4>>, %[[TWO]] {uniq_name = ".array.expr"}
! CHECK: fir.freemem %[[HEAP]] : !fir.heap<!fir.array<?x!fir.logical<4>>>
Module w0b
Integer,Parameter :: a(*,*) = Reshape( [ 1,2,3,4 ], [ 2,2 ])
contains
Subroutine test1(i,expect)
Integer,Intent(In) :: i,expect(:)
Logical :: ok = .True.
If (Any(a(:,i)/=expect)) Then
!Print *,'FAIL 1:',a(:,i),'/=',expect
ok = .False.
End If
End Subroutine
End Module