[llvm-bugs] [Bug 50164] New: Problem in C++4OpenCL calling copy constructor from object in __constant addr space

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 29 01:38:26 PDT 2021


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

            Bug ID: 50164
           Summary: Problem in C++4OpenCL calling copy constructor from
                    object in __constant addr space
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: OpenCL
          Assignee: unassignedclangbugs at nondot.org
          Reporter: drohr at jwdt.org
                CC: anastasia.stulova at arm.com, llvm-bugs at lists.llvm.org

Created attachment 24812
  --> https://bugs.llvm.org/attachment.cgi?id=24812&action=edit
testcase

The attached test case fails to compile in C++4OpenCL with a problem invoking
the copy constructor from an object in constant address space. If I make the
member of the object private and access it directly, feeding it in a
constructor again, bypassing the pass-by-reference to the copy constructor, it
actually works (done in workaround.patch). But I'd prefer to find a proper
solution.

Note: the test case requires https://reviews.llvm.org/D101168.
I have been testing with clang trunk (clang version 13.0.0
(https://github.com/llvm/llvm-project.git
837fded984ed36fa462daeb0f671eec58f71ae26)) + https://reviews.llvm.org/D101168
and with the following command line:
/home/qon/alice/llvm-project/build/bin/clang++ -O0 -cl-std=clc++ -x cl
-emit-llvm --target=spir64-unknown-unknown -Xclang -fdenormal-fp-math-f32=ieee
-cl-mad-enable -cl-no-signed-zeros -ferror-limit=1000
-Dcl_clang_storage_class_specifiers -c fail.cl -o test.bc

(I am not sure whether this is related to
https://bugs.llvm.org/show_bug.cgi?id=50163, but the error message is
different, so I am opening an independent bug report)

The error I am getting in the compilation is:
In file included from ../Base/opencl-common/GPUReconstructionOCL.cl:80:
In file included from ../Base/GPUReconstructionIncludesDevice.h:31:
In file included from ../SliceTracker/GPUTPCTracker.cxx:21:
In file included from ../SliceTracker/GPUTPCTrackletConstructor.h:20:
In file included from ../Base/GPUConstantMem.h:25:
In file included from ../TRDTracking/GPUTRDTracker.h:23:
In file included from ../TRDTracking/GPUTRDTrack.h:46:
In file included from ../TRDTracking/GPUTRDInterfaces.h:140:
In file included from
/home/qon/alice/O2/DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackTPCITS.h:20:
In file included from
/home/qon/alice/O2/DataFormats/Reconstruction/include/ReconstructionDataFormats/GlobalTrackID.h:20:
/home/qon/alice/O2/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/DetID.h:189:63:
error: no matching constructor for initialization of 'DetID::mask_t' (aka
'bitset<32>')
inline constexpr DetID::mask_t DetID::getMask(ID id) { return
detid_internal::sMasks[id]; }
                                                             
^~~~~~~~~~~~~~~~~~~~~~~~~~
../GPUUtils/GPUCommonBitSet.h:38:27: note: candidate constructor not viable:
cannot bind reference in address space '__constant' to object in address space
'__generic' in 1st argument
                constexpr bitset(const bitset&) = default;
                          ^
../GPUUtils/GPUCommonBitSet.h:39:20: note: candidate constructor not viable: no
known conversion from '__constant DetID::mask_t' (aka '__constant bitset<32>')
to '__private unsigned int' for 1st argument
         constexpr bitset(unsigned int vv) : v(vv){};
                   ^
../GPUUtils/GPUCommonBitSet.h:37:27: note: candidate constructor not viable:
requires 0 arguments, but 1 was provided
                constexpr bitset() = default;
                          ^

-- 
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/20210429/e9fbd361/attachment.html>


More information about the llvm-bugs mailing list