[flang-commits] [PATCH] D138121: [flang] Add hlfir.designate definition

Pete Steinfeld via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Nov 16 07:52:56 PST 2022


PeteSteinfeld requested changes to this revision.
PeteSteinfeld added a comment.
This revision now requires changes to proceed.

Things build OK and generally look good, but when I run tests, I get failures in the tests for .../HLFIR/designate.fir and .../HLFIR/invalid.fir.  Here's the relevant excerpts from the log file:

  ******************** TEST 'Flang :: HLFIR/designate.fir' FAILED ********************
  Script:
  --
  : 'RUN: at line 3';   fir-opt /local/home/psteinfeld/main/designate/flang/test/HLFIR/designate.fir | fir-opt | /local/home/psteinfeld/main/designate/build/bin/FileCheck /local/home/psteinfeld/main/designate/flang/test/HLFIR/designate.fir
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  /local/home/psteinfeld/main/designate/flang/test/HLFIR/designate.fir:68:8: error: 'hlfir.designate' op result type rank is not consistent with operands, expected rank 21867
    %0 = hlfir.designate %arg0 substr %c3, %c4 typeparams %c2:  (!fir.boxchar<1>, index, index, index) -> !fir.boxchar<1>
         ^
  /local/home/psteinfeld/main/designate/flang/test/HLFIR/designate.fir:68:8: note: see current operation: %3 = "hlfir.designate"(%arg0, %1, %2, %0) {is_triplet = array<i1>, operand_segment_sizes = array<i32: 1, 0, 0, 2, 0, 1>} : (!fir.boxchar<1>, index, index, index) -> !fir.boxchar<1>
  /local/home/psteinfeld/main/designate/flang/test/HLFIR/designate.fir:11:17: error: CHECK-LABEL: expected string not found in input
  // CHECK-LABEL: func.func @array_ref(
                  ^
  <stdin>:1:1: note: scanning from here
  module {
  ^
  
  Input file: <stdin>
  Check file: /local/home/psteinfeld/main/designate/flang/test/HLFIR/designate.fir
  
  -dump-input=help explains the following input dump.
  
  Input was:
  <<<<<<
            1: module { 
  label:11     X~~~~~~~~ error: no match found
            2: } 
  label:11     ~~
            3:  
  label:11     ~
  >>>>>>
  
  --
  
  ********************
  
    ....
  
  ******************** TEST 'Flang :: HLFIR/invalid.fir' FAILED ********************
  Script:
  --
  : 'RUN: at line 3';   fir-opt -split-input-file -verify-diagnostics /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir
  --
  Exit Code: 1
  
  Command Output (stdout):
  --
  
  // -----
  
  // -----
  
  // -----
  module {
    func.func @bad_array_declare(%arg0: !fir.ref<!fir.array<?x?xf32>>) {
      %0:2 = hlfir.declare %arg0 {uniq_name = "x"} : (!fir.ref<!fir.array<?x?xf32>>) -> (!fir.box<!fir.array<?x?xf32>>, !fir.ref<!fir.array<?x?xf32>>)
      return
    }
  }
  
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  // -----
  
  --
  Command Output (stderr):
  --
  within split at /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir:204 offset :4:8: error: unexpected error: 'hlfir.designate' op result type rank is not consistent with operands, expected rank 21981
    %0 = hlfir.designate %arg0 imag:  (!fir.ref<!fir.complex<4>>) -> !fir.ref<!fir.complex<4>>
         ^
  within split at /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir:204 offset :3:6: error: expected error "'hlfir.designate' op result element type is not consistent with operands, expected '!fir.real<4>'" was not produced
    // expected-error at +1 {{'hlfir.designate' op result element type is not consistent with operands, expected '!fir.real<4>'}}
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  within split at /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir:211 offset :4:8: error: unexpected error: 'hlfir.designate' op result type rank is not consistent with operands, expected rank 21981
    %0 = hlfir.designate %arg0 imag:  (!fir.ref<!fir.box<!fir.complex<4>>>) -> !fir.ref<!fir.box<!fir.real<4>>>
         ^
  within split at /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir:211 offset :3:6: error: expected error "'hlfir.designate' op result type must only be a box address type if it designates a component that is a fir.box or fir.class and if there are no indices, substrings, and complex part" was not produced
    // expected-error at +1 {{'hlfir.designate' op result type must only be a box address type if it designates a component that is a fir.box or fir.class and if there are no indices, substrings, and complex part}}
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  within split at /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir:235 offset :5:8: error: unexpected error: 'hlfir.designate' op result type rank is not consistent with operands, expected rank 21981
    %0 = hlfir.designate %arg0 substr %c1, %c1:  (!fir.ref<!fir.char<1,10>>, index, index) -> !fir.boxchar<1>
         ^
  within split at /local/home/psteinfeld/main/designate/flang/test/HLFIR/invalid.fir:235 offset :4:6: error: expected error "'hlfir.designate' op must be provided one length parameter when the result is a character" was not produced
    // expected-error at +1 {{'hlfir.designate' op must be provided one length parameter when the result is a character}}
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  --
  
  ********************



================
Comment at: flang/include/flang/Optimizer/HLFIR/HLFIRDialect.h:45
+
+/// If this the type of a Fortran array entity, get the related
+/// fir.array type. Otherwise, returns the Fortran element typeof the entity.
----------------
Should read "If this is the type..."


================
Comment at: flang/include/flang/Optimizer/HLFIR/HLFIROps.td:141
+  let description = [{
+    This operations represents a Fortran "part-ref", except that it can embed
+    substring or complex part directly, and that vector subscripts cannot be used.
----------------
Should read "This operation represents ..."


================
Comment at: flang/include/flang/Optimizer/HLFIR/HLFIROps.td:142
+    This operations represents a Fortran "part-ref", except that it can embed
+    substring or complex part directly, and that vector subscripts cannot be used.
+    It returns a Fortran variable that is a part of the input variable.
----------------
Should read "a substring or ..."


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138121/new/

https://reviews.llvm.org/D138121



More information about the flang-commits mailing list