[all-commits] [llvm/llvm-project] c8a9af: [flang] Handle reversed bounds and negative length...

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Jun 13 08:35:26 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c8a9afe7c81bc874debbe319f3cf6b7b89f90aa2
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2022-06-13 (Mon, 13 Jun 2022)

  Changed paths:
    M flang/lib/Optimizer/Builder/MutableBox.cpp
    M flang/test/Lower/allocatables.f90

  Log Message:
  [flang] Handle reversed bounds and negative length in inlined allocation

ALLOCATE statement allows reversed bounds (see Fortran 2018
point 1) in which case the extents are zero.

The same applies for the character length provided in the type spec that
can be negative. In which case the new length is zero.

Use genMaxWithZero to deal with these cases.

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

Reviewed By: jeanPerier, PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier at nvidia.com>

More information about the All-commits mailing list