llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Function resolution should follow the same rule in global context as function body.

Open darkbuck opened this issue 6 years ago • 1 comments

Bugzilla Link 44266
Version trunk
OS Linux
Attachments resolution under function gets the correct host function, sample code for function resolution in global initializers
CC @dwblaikie,@jlebar,@Artem-B

Extended Description

In the following sample code

__device__ float fn(int);
__host__ float fn(float);

float gvar = fn(1);

clang failed to find the correct candidate of fn. But, if we modify that to resolve fn under a function body. The correct one is used.

__device__ float fn(int);
__host__ float fn(float);

float gfunc() {
  return fn(1);
}

For function resolution in (host-side) global initializers, we should follow the same rule as the one under a function body.

darkbuck avatar Dec 10 '19 19:12 darkbuck

fix is submitted @ https://reviews.llvm.org/D71227 for review

darkbuck avatar Dec 10 '19 19:12 darkbuck