[all-commits] [llvm/llvm-project] 181eab: [flang] Set KIND in compiler generated COUNT for S...

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Jan 29 09:29:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 181eab27d244b9a9eb32d6716f9c38f7f3723356
      https://github.com/llvm/llvm-project/commit/181eab27d244b9a9eb32d6716f9c38f7f3723356
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-01-29 (Mon, 29 Jan 2024)

  Changed paths:
    M flang/include/flang/Evaluate/common.h
    M flang/include/flang/Lower/Bridge.h
    M flang/lib/Evaluate/shape.cpp
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Semantics/semantics.cpp
    A flang/test/Evaluate/rewrite07.f90
    M flang/unittests/Evaluate/expression.cpp
    M flang/unittests/Evaluate/folding.cpp
    M flang/unittests/Evaluate/intrinsics.cpp

  Log Message:
  -----------
  [flang] Set KIND in compiler generated COUNT for SIZE(PACK) (#79801)

Compiler was rewriting SIZE(PACK(x, MASK)) to COUNT(MASK). It was
wrapping the COUNT call without a KIND argument (leading to INTEGER(4)
result in the characteristics) in an Expr<ExtentType> (implying
INTEGER(8) result), this lead to inconsistencies that later hit verifier
errors in lowering.

Set the KIND argument to the KIND of ExtentType to ensure the built
expression is consistent.

This requires giving access to some safe place where the "kind" name can
be saved and turned into a CharBlock (count has a DIM argument that
require using the KIND keyword here). For the FoldingContext that belong
to SemanticsContext, this is the same string set as the one used by
SemanticsContext for similar purposes.




More information about the All-commits mailing list