aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorharishch4 <harishcse44@gmail.com>2024-04-01 17:13:22 +0530
committerGitHub <noreply@github.com>2024-04-01 17:13:22 +0530
commitf546b6ef3c15a156959dde16fa5f03a350a0a2be (patch)
treeba34dda0dc5b98aa660f823e9146544c1b666725 /llvm/lib/CodeGen/MachineVerifier.cpp
parente701c1a653088488ef67a9fa5b01ab37a482b690 (diff)
downloadllvm-f546b6ef3c15a156959dde16fa5f03a350a0a2be.zip
llvm-f546b6ef3c15a156959dde16fa5f03a350a0a2be.tar.gz
llvm-f546b6ef3c15a156959dde16fa5f03a350a0a2be.tar.bz2
[Flang] Relaxing an error when contiguous pointer is assigned to a non-contig… (#86781)
…uous function. Fix from [thtsikas](https://github.com/thtsikas) based on a discussion in [slack](https://flang-compiler.slack.com/archives/C5C58TT32/p1711124374836079). Example: ``` Program test Integer, Pointer, Contiguous :: cont(:) Interface Function f() Integer, Pointer :: f(:) End Function End Interface cont => f() Print *, cont(3) End Program Function f() Integer, Pointer :: f(:) Allocate (f(4),Source=[1,1,42,1]) ! f => f(4:1:-1) !! not contiguous, runtime error End Function f ``` Understanding is that the standard intended to allow this pattern. The restriction 10.2.2.3 p6 Data pointer assignment "If the pointer object has the CONTIGUOUS attribute, the pointer target shall be contiguous." is not associated with a numbered constraint. If there is a mechanism for injecting runtime checks, this would be a place to do it. Absent that, a warning is the best we can do. No other compiler treats contigPtr => func() as an error when func() is not CONTIGUOUS, so a warning would probably be better for consistency. https://godbolt.org/z/5cM6roeEE
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
0 files changed, 0 insertions, 0 deletions