[llvm-bugs] [Bug 49264] New: taking address of function is not allowed enabling __cl_clang_function_pointers
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Feb 19 05:34:40 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49264
Bug ID: 49264
Summary: taking address of function is not allowed enabling
__cl_clang_function_pointers
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: matteo.concas at cern.ch
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 24553
--> https://bugs.llvm.org/attachment.cgi?id=24553&action=edit
Makefile with reproducer and workaround files
LSB Release:
LSB Version:
:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 8.3.2011
Release: 8.3.2011
Codename: n/a
Clang version:
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
a874d182c61c7f8e5291c718b40be0e133bf21f0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/clang/bin
Issue:
Passing a static constexpr function as an argument to another function as done
here (see reproducer.cl in attached archive):
namespace namespace row_offsets_utils
{
[omitted, see attached files for full reproducer]
template <int I0, class F, int... I>
constexpr auto do_make(F f, indices<I...>) -> o2::gpu::gpustd::array<int,
sizeof...(I)>
{
o2::gpu::gpustd::array<int, sizeof...(I)> retarr = {f(I0 + I)...};
return retarr;
}
template <int N, int I0 = 0, class F>
constexpr auto make(F f) -> o2::gpu::gpustd::array<int, N>
{
return do_make<I0>(f, typename make_indices<N>::type());
}
}
template <class T, unsigned int D>
class MatRepSymGPU
{
[omitted, see attachd files for full reproducer]
static constexpr int off1(int i) { return off2(i / D, i % D); }
static int off(int i)
{
static constexpr auto v = row_offsets_utils::make<D * D>(off1);
return v[i];
}
};
breaks compilation with:
error: taking address of function is not allowed
static constexpr auto v = row_offsets_utils::make<D * D>(off1);
^
1 error generated.
I know this is not supported by OpenCL itself, but I had expected it to work
with __cl_clang_function_pointers, particularly since the slightly modified
version of the code compiles (see workaround.cl in attached archive).
--
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/20210219/c072c650/attachment-0001.html>
More information about the llvm-bugs
mailing list