Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull 2018-01-25T12-01 Recent NVIDIA Changes #371

Merged
merged 4 commits into from
Jan 25, 2018
Merged

Pull 2018-01-25T12-01 Recent NVIDIA Changes #371

merged 4 commits into from
Jan 25, 2018

Conversation

tskeith
Copy link
Contributor

@tskeith tskeith commented Jan 25, 2018

No description provided.

We were passing a constant value to a function argument where we were expecting
a descriptor, which leads to a seg fault. The constant is created in the front
end "transform_call", where we are missing a case here, when there is no member
descriptor, use SDSC instead.
This bug occurs when we have a contiguous pointer to an array section that
is passed to an assumed-shape formal like in this example:
	integer, pointer, contiguous :: p(:,:)
	integer, pointer :: matrix(:,:,:)
	allocate(matrix(...))
	p => matrix(:,:,n)
	call sub(p)

The section descriptor that we create and pass in to the procedure has an
lbase value that represents the distance from the start of the array to the
start of the section that the pointer represents.

When we pass in the address of the first element that p points to, that
distance is included in the pointer. So combined with the lbase offset in
the descriptor we end up indexing too far into the array (or past the end).

To fix this we need to either adjust the descriptor or pass in the address
of the array instead of the first element of the section. This fix does the
latter.
@sscalpone sscalpone merged commit fd99090 into flang-compiler:master Jan 25, 2018
@sscalpone sscalpone deleted the nv_stage branch January 25, 2018 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants