[Bug c++/52725] error: capture of non-variable (in regards to a variable)
steffen_moeller at gmx dot de
gcc-bugzilla@gcc.gnu.org
Fri May 25 11:10:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52725
Steffen Möller <steffen_moeller at gmx dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steffen_moeller at gmx dot
| |de
--- Comment #2 from Steffen Möller <steffen_moeller at gmx dot de> 2012-05-25 10:33:51 UTC ---
Hello, I have something similar in the OpenMM code
(https://simtk.org/home/openmm), with no ()s following the "new" as in
template <typename T>
struct CUDAStream : public SoADeviceObject
{
unsigned int _length;
unsigned int _subStreams; # line 68
unsigned int _stride;
T** _pSysStream;
T** _pDevStream;
T* _pSysData;
T* _pDevData;
std::string _name;
CUDAStream(int length, int subStreams = 1, std::string name="");
CUDAStream(unsigned int length, unsigned int subStreams = 1, std::string
name="");
CUDAStream(unsigned int length, int subStreams = 1, std::string name="");
CUDAStream(int length, unsigned int subStreams = 1, std::string name="");
virtual ~CUDAStream();
void Allocate();
void Deallocate();
void Upload();
void Download();
void CopyFrom(const CUDAStream<T>& src);
void Collapse(unsigned int newstreams = 1, unsigned int interleave = 1);
T& operator[](int index);
};
[...]
template <typename T>
void CUDAStream<T>::Allocate()
{
cudaError_t status;
_pSysStream = new T*[_subStreams]; # line 125
_pDevStream = new T*[_subStreams];
_pSysData = new T[_subStreams * _stride];
status = cudaMalloc((void **) &_pDevData, _stride * _subStreams *
sizeof(T));
RTERROR(status, (_name+": cudaMalloc in CUDAStream::Allocate
failed").c_str());
for (unsigned int i = 0; i < _subStreams; i++)
{
_pSysStream[i] = _pSysData + i * _stride;
_pDevStream[i] = _pDevData + i * _stride;
}
}
for which 4.6.3 (Debian 4.6.3-5) happily crunches but 4.7 (Debian 4.7.0-9)
gives me
cd
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/obj-x86_64-linux-gnu/platforms/cuda/sharedTarget
&& /usr/local/bin/c++ -DOpenMMCuda_EXPORTS -DOPENMM_LIBRARY_NAME=OpenMM
-DOPENMM_MAJOR_VERSION=1 -DOPENMM_MINOR_VERSION=0 -DOPENMM_BUILD_VERSION=0
-DOPENMM_SVN_REVISION=\"exported\" -DOPENMM_COPYRIGHT_YEARS=\"2008\"
-DOPENMM_AUTHORS=\"Peter.Eastman\" -O3 -DNDEBUG -fPIC
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/src
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/src
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/libraries/validate/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/reference/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/libraries/lbfgs/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/libraries/sfmt/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/libraries/lepton/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/libraries/quern/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/libraries/jama/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/olla/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/openmmapi/include
-I/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/./include
-DOPENMMCUDA_BUILDING_SHARED_LIBRARY -o
CMakeFiles/OpenMMCuda.dir/__/__/__/src/cuda/kApplyConstraints.cu_OpenMMCuda_generated.cpp.o
-c
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/obj-x86_64-linux-gnu/src/cuda/kApplyConstraints.cu_OpenMMCuda_generated.cpp
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:
In member function ‘virtual void CUDAStream<T>::Allocate()’:
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:125:27:
error: capture of non-variable ‘CUDAStream<T>::_subStreams’
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:68:10:
note: ‘unsigned int CUDAStream<T>::_subStreams’ declared here
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:126:27:
error: capture of non-variable ‘CUDAStream<T>::_subStreams’
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:68:10:
note: ‘unsigned int CUDAStream<T>::_subStreams’ declared here
make[3]: ***
[platforms/cuda/sharedTarget/CMakeFiles/OpenMMCuda.dir/__/__/__/src/cuda/kApplyConstraints.cu_OpenMMCuda_generated.cpp.o]
Error 1
Thanks and regards,
Steffen
More information about the Gcc-bugs
mailing list