[Bug c++/52725] error: capture of non-variable for new-expression incorrectly parsed as lambda-expression

2012-05-29 Thread steffen_moeller at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52725

--- Comment #4 from Steffen Möller steffen_moeller at gmx dot de 2012-05-29 
10:33:36 UTC ---
Hello, this took me a while.

It seems like the problem is in (or in the interaction with) nvcc, the NVidia
compiler. For that you program for the graphics card and the host processor at
the same time. The .cu files indicate such files that are not meant to be seen
by the regular compiler at a first sight. It then generates preprocessed files
for gcc to digest.

$ rm -f t.cu_OpenMMCuda_generated.cpp; /usr/bin/nvcc t.cu -cuda -o
t.cu_OpenMMCuda_generated.cpp  g++ -c t.cu_OpenMMCuda_generated.cpp
t.cu: In member function ‘void CUDAStreamT::Allocate()’:
t.cu:12:27: error: capture of non-variable ‘CUDAStreamT::_subStreams’ 
t.cu:4:10: note: ‘unsigned int CUDAStreamT::_subStreams’ declared here

$ cat t.cu
template typename T
struct CUDAStream
{
unsigned int_subStreams;
T** _pSysStream;
void Allocate();
};

template typename T
void CUDAStreamT::Allocate()
{
_pSysStream =   new T*[_subStreams];
}


The NVCC-generated code now has the ()s again:

# 9 t.cu
template class T void
# 10 t.cu
CUDAStream T ::Allocate()
# 11 t.cu
{
# 12 t.cu
(_pSysStream) = (new (T *[_subStreams]));
# 13 t.cu
}

4.6 crunges it, 4.7 does not. Sounds like we should prepare an email to NVidia.
Anybody with any direct contacts?

Thanks

Steffen


[Bug c++/52725] error: capture of non-variable for new-expression incorrectly parsed as lambda-expression

2012-05-29 Thread steffen_moeller at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52725

--- Comment #5 from Steffen Möller steffen_moeller at gmx dot de 2012-05-29 
11:31:04 UTC ---
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2012 NVIDIA Corporation
Built on Thu_Apr__5_00:24:31_PDT_2012
Cuda compilation tools, release 4.2, V0.2.1221

as shipping with Debian unstable in package version 4.2.9-1.


[Bug c++/52725] error: capture of non-variable (in regards to a variable)

2012-05-25 Thread steffen_moeller at gmx dot de
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 CUDAStreamT src);
void Collapse(unsigned int newstreams = 1, unsigned int interleave = 1);
T operator[](int index);
};

[...]

template typename T
void CUDAStreamT::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 CUDAStreamT::Allocate()’:
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:125:27:
error: capture of non-variable ‘CUDAStreamT::_subStreams’ 
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:68:10:
note: ‘unsigned int CUDAStreamT::_subStreams’ declared here
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:126:27:
error: capture of non-variable ‘CUDAStreamT::_subStreams’ 
/homeLvm/moeller/alioth/debichem/experimental/openmm-4.1/platforms/cuda/./src/kernels//cudatypes.h:68:10:
note: ‘unsigned int CUDAStreamT::_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


[Bug debug/50279] [4.7 Regression] ICE while building the go front-end with LTO enabled

2011-09-04 Thread steffen_moeller at gmx dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50279

Steffen Möller steffen_moeller at gmx dot de changed:

   What|Removed |Added

 CC||steffen_moeller at gmx dot
   ||de

--- Comment #1 from Steffen Möller steffen_moeller at gmx dot de 2011-09-04 
13:08:36 UTC ---
The same error occurs while compiling the Debian package autodocksuite from sid
with LTO enabled:

/usr/lib/gcc-snapshot/bin/g++  -Wall -g -flto -O2  -Winline -finline-functions 
-Wl,--as-needed -flto -o autogrid4 autogrid4-main.o autogrid4-check_size.o
autogrid4-setflags.o autogrid4-timesys.o autogrid4-timesyshms.o
autogrid4-printhms.o autogrid4-prHMSfixed.o autogrid4-printdate.o
autogrid4-strindex.o autogrid4-banner.o autogrid4-gpfparser.o
autogrid4-parsetypes.o autogrid4-atom_parameter_manager.o
autogrid4-read_parameter_library.o autogrid4-parse_param_line.o
autogrid4-distdepdiel.o  -lm 
In file included from setflags.cpp:142:0,
 from :118:
main.cpp: In function 'main':
main.cpp:2542:1: internal compiler error: in splice_child_die, at
dwarf2out.c:5007
Please submit a full bug report,
with preprocessed source if appropriate.

$ /usr/lib/gcc-snapshot/bin/g++ --version
g++ (Debian 20110816-1) 4.7.0 20110816 (experimental) [trunk revision 177785]

Sorry for not isolating the problem more. The problem could not be observed in
g++ 4.6.1 from Debian unstable (4.6.1-8). It fails later, hence the
installation of the snapshot :) Without the LTO, everything is fine.