This is an archive of the discontinued LLVM Phabricator instance.

[flang] Initial support for storage conflict check
AbandonedPublic

Authored by peixin on May 18 2022, 7:47 AM.

Details

Summary

This checks the storage conflict in arguments of elemental call. It is
dangerous to use in that way, so try to report one warning. The dynamic
analysis for pointers and non-compile time array indices is not covered.
Also, do not check the array indices since it is not easy to know if
the arguments use different slices.

Diff Detail

Event Timeline

peixin created this revision.May 18 2022, 7:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 7:47 AM
peixin requested review of this revision.May 18 2022, 7:47 AM
program m
  integer :: x, y, z = 1
  equivalence(x, y)
  call sub3(x, y, z)
  print *, x
contains
  subroutine sub3(a, b, c)
    integer :: a, b, c
    a = c
    b = c + 1
  end
end

In the long term, there should be warnings for the scenarios such as the above test case. Although this is not one priority work, it seems that we should have one storage conflict static check finally. Is this right?

You will probably have to wait till WARNINGs support is enabled in test_errors.py (https://reviews.llvm.org/D125804).

You will probably have to wait till WARNINGs support is enabled in test_errors.py (https://reviews.llvm.org/D125804).

Thanks for the notice. I didn't notice the warnings are not checked for the tests under /semantics.

peixin edited the summary of this revision. (Show Details)May 24 2022, 5:58 AM
peixin updated this revision to Diff 437178.Jun 15 2022, 8:03 AM

Rebase and use FileCheck for test case to proceed for review.

peixin updated this revision to Diff 437181.Jun 15 2022, 8:07 AM

Chang i++ into ++i.

peixin planned changes to this revision.Jun 17 2022, 8:22 AM
peixin abandoned this revision.Jul 6 2023, 6:16 PM