[PATCH] D78424: [flang] Added Semantic Checks for 2 Data constraints and fixed the semantic errors in 3 test cases

Anchu Rajendran S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 04:17:07 PDT 2020


anchu-rajendran updated this revision to Diff 259225.
anchu-rajendran edited the summary of this revision.
anchu-rajendran added a comment.

Fixed a few corner cases:
Implemented a function: `GetFirstName`

  module dt
    type d
      real r
    end type
  end module
  program test
    use dt
    type(d) :: d1
    data d1%r/2.5/
  end program

In the above example, `d1%r` should not be identified as use-associated since, `d1` is declared in the same scope. Previous  revision identifies `d1%r` as use associated  since the semantic checks were performed on last name `r` and not on first name:`d1`. The current revision applies checks on first name.

A few other corner cases will also be caught with this modification. An example follows:

   module m2
      type newType
        integer number
      end type
      contains
      subroutine checkDerivedType(m2_number)
        type(newType) m2_number
        DATA m2_number%number /1/
     end
  end

In the above example, `m2_number%number` should not be used as a data obect as it is a dummy argument. This constraint will only be checked if check is applied on first name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78424

Files:
  flang/include/flang/Parser/tools.h
  flang/include/flang/Semantics/tools.h
  flang/lib/Parser/tools.cpp
  flang/lib/Semantics/check-data.cpp
  flang/lib/Semantics/check-data.h
  flang/lib/Semantics/resolve-names-utils.cpp
  flang/test/Lower/pre-fir-tree02.f90
  flang/test/Semantics/block-data01.f90
  flang/test/Semantics/data01.f90
  flang/test/Semantics/data04.f90

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78424.259225.patch
Type: text/x-patch
Size: 18667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200422/5fb50a6a/attachment-0001.bin>


More information about the llvm-commits mailing list