[llvm-bugs] [Bug 44266] New: Function resolution should follow the same rule in global context as function body.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 10 11:23:49 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44266

            Bug ID: 44266
           Summary: Function resolution should follow the same rule in
                    global context as function body.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: CUDA
          Assignee: unassignedclangbugs at nondot.org
          Reporter: michael.hliao at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22925
  --> https://bugs.llvm.org/attachment.cgi?id=22925&action=edit
resolution under function gets the correct host function

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191210/9380684d/attachment.html>


More information about the llvm-bugs mailing list