You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Marian doesn't compile with gcc 12.3.1 due to issues with intrusive pointer. Note that there are two kinds of error: pointer used after and pointer may be used. It would seem in the first error that the compiler is definitely finding an issue.
gcc --version
gcc (Gentoo 12.3.1_p20230526 p2) 12.3.1 20230526
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
In file included from /home/kpu/marian-dev/src/common/definitions.h:5,
from /home/kpu/marian-dev/src/tensors/tensor.h:3,
from /home/kpu/marian-dev/src/optimizers/clippers.h:6,
from /home/kpu/marian-dev/src/optimizers/clippers.cpp:1:
In function ‘void marian::intrusivePtrRelease(TensorBase*)’,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘virtual float marian::ElementwiseClipper::clip(marian::Tensor, float)’ at /home/kpu/marian-dev/src/optimizers/clippers.cpp:9:10:
/home/kpu/marian-dev/src/common/intrusive_ptr.h:24:23: error: pointer used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
24 | if(x != 0 && --x->references_ == 0) { \
| ~~~^~~~~~~~~~~
/home/kpu/marian-dev/src/tensors/tensor.h:38:3: note: in expansion of macro ‘ENABLE_INTRUSIVE_PTR’
38 | ENABLE_INTRUSIVE_PTR(TensorBase)
| ^~~~~~~~~~~~~~~~~~~~
In destructor ‘virtual marian::TensorBase::~TensorBase()’,
inlined from ‘void marian::intrusivePtrRelease(TensorBase*)’ at /home/kpu/marian-dev/src/tensors/tensor.h:38:3,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::Element(Functor, Tensor, Tensors ...) [with Functor = functional::Assign<functional::Var<1>, functional::BinaryFunctor<functional::elem::Clip, functional::Assignee<1>, functional::Capture> >; Tensors = {}]’ at /home/kpu/marian-dev/src/tensors/tensor_operators.h:75:17,
inlined from ‘virtual float marian::ElementwiseClipper::clip(marian::Tensor, float)’ at /home/kpu/marian-dev/src/optimizers/clippers.cpp:9:10:
/home/kpu/marian-dev/src/tensors/tensor.h:76:26: note: call to ‘void operator delete(void*, std::size_t)’ here
76 | virtual ~TensorBase() {}
| ^
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/marian.dir/build.make:958: src/CMakeFiles/marian.dir/optimizers/clippers.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/kpu/marian-dev/src/common/definitions.h:5,
from /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:1:
In function ‘void marian::intrusivePtrRelease(TensorBase*)’,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/common/intrusive_ptr.h:24:23: error: pointer may be used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
24 | if(x != 0 && --x->references_ == 0) { \
| ~~~^~~~~~~~~~~
/home/kpu/marian-dev/src/tensors/tensor.h:38:3: note: in expansion of macro ‘ENABLE_INTRUSIVE_PTR’
38 | ENABLE_INTRUSIVE_PTR(TensorBase)
| ^~~~~~~~~~~~~~~~~~~~
In file included from /home/kpu/marian-dev/src/tensors/tensor_operators.h:5,
from /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:3:
In destructor ‘virtual marian::TensorBase::~TensorBase()’,
inlined from ‘void marian::intrusivePtrRelease(TensorBase*)’ at /home/kpu/marian-dev/src/tensors/tensor.h:38:3,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::Element(Functor, Tensor, Tensors ...) [with Functor = functional::Assign<functional::Var<1>, functional::BinaryFunctor<functional::elem::Plus, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<1> >, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<2> > > >; Tensors = {IntrusivePtr<TensorBase>}]’ at /home/kpu/marian-dev/src/tensors/tensor_operators.h:75:17,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/tensors/tensor.h:76:26: note: call to ‘void operator delete(void*, std::size_t)’ here
76 | virtual ~TensorBase() {}
| ^
In function ‘void marian::intrusivePtrRelease(TensorBase*)’,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/common/intrusive_ptr.h:24:23: error: pointer may be used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
24 | if(x != 0 && --x->references_ == 0) { \
| ~~~^~~~~~~~~~~
/home/kpu/marian-dev/src/tensors/tensor.h:38:3: note: in expansion of macro ‘ENABLE_INTRUSIVE_PTR’
38 | ENABLE_INTRUSIVE_PTR(TensorBase)
| ^~~~~~~~~~~~~~~~~~~~
In destructor ‘virtual marian::TensorBase::~TensorBase()’,
inlined from ‘void marian::intrusivePtrRelease(TensorBase*)’ at /home/kpu/marian-dev/src/tensors/tensor.h:38:3,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::Element(Functor, Tensor, Tensors ...) [with Functor = functional::Assign<functional::Var<1>, functional::BinaryFunctor<functional::elem::Plus, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<1> >, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<2> > > >; Tensors = {IntrusivePtr<TensorBase>}]’ at /home/kpu/marian-dev/src/tensors/tensor_operators.h:75:17,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/tensors/tensor.h:76:26: note: call to ‘void operator delete(void*, std::size_t)’ here
76 | virtual ~TensorBase() {}
| ^
In function ‘void marian::intrusivePtrRelease(TensorBase*)’,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/common/intrusive_ptr.h:24:23: error: pointer may be used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
24 | if(x != 0 && --x->references_ == 0) { \
| ~~~^~~~~~~~~~~
/home/kpu/marian-dev/src/tensors/tensor.h:38:3: note: in expansion of macro ‘ENABLE_INTRUSIVE_PTR’
38 | ENABLE_INTRUSIVE_PTR(TensorBase)
| ^~~~~~~~~~~~~~~~~~~~
In destructor ‘virtual marian::TensorBase::~TensorBase()’,
inlined from ‘void marian::intrusivePtrRelease(TensorBase*)’ at /home/kpu/marian-dev/src/tensors/tensor.h:38:3,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::Element(Functor, Tensor, Tensors ...) [with Functor = functional::Assign<functional::Var<1>, functional::BinaryFunctor<functional::elem::Plus, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<1> >, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<2> > > >; Tensors = {IntrusivePtr<TensorBase>}]’ at /home/kpu/marian-dev/src/tensors/tensor_operators.h:75:17,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/tensors/tensor.h:76:26: note: call to ‘void operator delete(void*, std::size_t)’ here
76 | virtual ~TensorBase() {}
| ^
In function ‘void marian::intrusivePtrRelease(TensorBase*)’,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/common/intrusive_ptr.h:24:23: error: pointer may be used after ‘void operator delete(void*, std::size_t)’ [-Werror=use-after-free]
24 | if(x != 0 && --x->references_ == 0) { \
| ~~~^~~~~~~~~~~
/home/kpu/marian-dev/src/tensors/tensor.h:38:3: note: in expansion of macro ‘ENABLE_INTRUSIVE_PTR’
38 | ENABLE_INTRUSIVE_PTR(TensorBase)
| ^~~~~~~~~~~~~~~~~~~~
In destructor ‘virtual marian::TensorBase::~TensorBase()’,
inlined from ‘void marian::intrusivePtrRelease(TensorBase*)’ at /home/kpu/marian-dev/src/tensors/tensor.h:38:3,
inlined from ‘IntrusivePtr<T>::~IntrusivePtr() [with T = marian::TensorBase]’ at /home/kpu/marian-dev/src/common/intrusive_ptr.h:66:26,
inlined from ‘void marian::Element(Functor, Tensor, Tensors ...) [with Functor = functional::Assign<functional::Var<1>, functional::BinaryFunctor<functional::elem::Plus, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<1> >, functional::BinaryFunctor<functional::elem::Mult, functional::Capture, functional::Assignee<2> > > >; Tensors = {IntrusivePtr<TensorBase>}]’ at /home/kpu/marian-dev/src/tensors/tensor_operators.h:75:17,
inlined from ‘void marian::ExponentialSmoothing::updateAvgParams(marian::Tensor, marian::Tensor, size_t, size_t)’ at /home/kpu/marian-dev/src/optimizers/exponential_smoothing.cpp:24:10:
/home/kpu/marian-dev/src/tensors/tensor.h:76:26: note: call to ‘void operator delete(void*, std::size_t)’ here
76 | virtual ~TensorBase() {}
| ^
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/marian.dir/build.make:986: src/CMakeFiles/marian.dir/optimizers/exponential_smoothing.cpp.o] Error 1
I've been trying to suss this out. It seems to be the temporary Tensor (i.e. an intrusive_ptr) is having the issue.
The text was updated successfully, but these errors were encountered:
Marian doesn't compile with gcc 12.3.1 due to issues with intrusive pointer. Note that there are two kinds of error:
pointer used after
andpointer may be used
. It would seem in the first error that the compiler is definitely finding an issue.I've been trying to suss this out. It seems to be the temporary
Tensor
(i.e. anintrusive_ptr
) is having the issue.The text was updated successfully, but these errors were encountered: