This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix incorrect diagnostics in map clause
ClosedPublic

Authored by davidsh on Jul 6 2016, 4:52 PM.

Details

Summary

Having the following code pattern will result in incorrect diagnostic
int main() {
int arr[10];
#pragma omp target data map(arr[:])
#pragma omp target map(arr)
{}
}
t.cpp:4:24: error: original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage
#pragma omp target map(arr)

^~~

t.cpp:3:29: note: used here
#pragma omp target data map(arr[:])

^~~~~~

1 error generated.

Diff Detail

Repository
rL LLVM

Event Timeline

davidsh updated this revision to Diff 62992.Jul 6 2016, 4:52 PM
davidsh retitled this revision from to [OpenMP] Fix incorrect diagnostics in map clause.
davidsh updated this object.
davidsh added a subscriber: cfe-commits.
sfantao edited edge metadata.Jul 6 2016, 5:52 PM

Hi David,

Thanks for the fix!

lib/Sema/SemaOpenMP.cpp
10639 ↗(On Diff #62992)

You have to document what you are trying to accomplish here, something like "Check if the extra components of the expressions in the enclosing data environment are redundant for the current base declaration. If they are, the maps completely overlap, which is legal."

You may add the snippet in that comment so that we can refer to that when trying to understand this code.

10654 ↗(On Diff #62992)

I'd rather use a for loop, move the iterator increment there, and invert the sense of this last if statement to break the loop.

davidsh edited edge metadata.

Address comments

Thanks. You have to wait for Alexey to take a look at the patch too.

Thanks again,
Samuel

ABataev added inline comments.Jul 11 2016, 3:22 AM
lib/Sema/SemaOpenMP.cpp
10667–10668 ↗(On Diff #63090)

Seems to me the code is not formatted properly.

Address formatting comment.

ABataev accepted this revision.Jul 13 2016, 8:10 PM
ABataev edited edge metadata.

LG

This revision is now accepted and ready to land.Jul 13 2016, 8:10 PM
davidsh edited edge metadata.

Fix a typo in code and address test case issues.

This revision was automatically updated to reflect the committed changes.