[GIL] runtime assertion error
Hello, I was playing with GIL a little and started out with the tutorial. After adapting it a bit I noticed a runtime assertion error here in color_base.hpp +343: template <typename Element, typename Layout, int K> typename element_reference_type<homogeneous_color_base<Element,Layout,K>
::type dynamic_at_c(homogeneous_color_base<Element,Layout,K>& cb, std::size_t i) { assert(i<K); return (gil_reinterpret_cast<Element*>(&cb))[i]; }
The example works if I compile in release but I still wanted to bring it up because of an extensive comment above this template that states that this assertion checks for compiler specific behavior and mentions flags that need to be set but not which flags. I believe there might be a bug there. Also, since it's the tutorial, I suppose it should work under most circumstances. I have a sample of the code attached. It's gcc 4.8 here in Linux 64. Nothing fancy. Boost 1.56. Cheers, Stephan
Hi Stephan, Hello,
I was playing with GIL a little and started out with the tutorial. After adapting it a bit I noticed a runtime assertion error here in color_base.hpp +343:
template <typename Element, typename Layout, int K> typename element_reference_type<homogeneous_color_base<Element,Layout,K>
::type dynamic_at_c(homogeneous_color_base<Element,Layout,K>& cb, std::size_t i) { assert(i<K); return (gil_reinterpret_cast<Element*>(&cb))[i]; }
The example works if I compile in release but I still wanted to bring it up because of an extensive comment above this template that states that this assertion checks for compiler specific behavior and mentions flags that need to be set but not which flags.
I believe there might be a bug there. Also, since it's the tutorial, I suppose it should work under most circumstances.
I have a sample of the code attached. It's gcc 4.8 here in Linux 64. Nothing fancy. Boost 1.56.
Could you try out the develop branch for gil/extension folder? Regards, Christian
On Sat, Jan 3, 2015 at 11:44 PM, Christian Henning <chhenning@gmail.com> wrote:
Could you try out the develop branch for gil/extension folder?
that took me a while. Had to clone the repo first and circumvent a build system error that prevented my from building master. Anyway, I did as you asked and the problem still persists. Same behavior, same message: test1: /home/sm/devel/modular-boost/boost/gil/color_base.hpp:343: typename boost::gil::element_reference_type<boost::gil::detail::homogeneous_color_base<Element, Layout, K> >::type boost::gil::detail::dynamic_at_c(boost::gil::detail::homogeneous_color_base<Element, Layout, K>&, std::size_t) [with Element = signed char; Layout = boost::gil::layout<boost::mpl::vector1<boost::gil::gray_color_t> >; int K = 1; typename boost::gil::element_reference_type<boost::gil::detail::homogeneous_color_base<Element, Layout, K> >::type = signed char&; std::size_t = long unsigned int]: Assertion `i<K' failed. Cheers, Stephan
I have to correct myself here. After all, I forgot to switch to that GIL branch you mentioned. After doing so, the jpeg import and export won't compile anymore and I couldn't figure out yet how the constructor of the image types works so I can create an empty image rather than retrieving it from the jpeg functions. GIL's interface really isn't for the faint hearted, is it? Anyway, I just wanted to let you know that my previous mail was faulty and I'm still working on it. Cheers, Stephan On Sun, Jan 4, 2015 at 5:05 PM, Stephan Menzel <stephan.menzel@gmail.com> wrote:
On Sat, Jan 3, 2015 at 11:44 PM, Christian Henning <chhenning@gmail.com> wrote:
Could you try out the develop branch for gil/extension folder?
that took me a while. Had to clone the repo first and circumvent a build system error that prevented my from building master.
Anyway, I did as you asked and the problem still persists. Same behavior, same message:
test1: /home/sm/devel/modular-boost/boost/gil/color_base.hpp:343: typename boost::gil::element_reference_type<boost::gil::detail::homogeneous_color_base<Element, Layout, K> >::type boost::gil::detail::dynamic_at_c(boost::gil::detail::homogeneous_color_base<Element, Layout, K>&, std::size_t) [with Element = signed char; Layout = boost::gil::layout<boost::mpl::vector1<boost::gil::gray_color_t> >; int K = 1; typename boost::gil::element_reference_type<boost::gil::detail::homogeneous_color_base<Element, Layout, K> >::type = signed char&; std::size_t = long unsigned int]: Assertion `i<K' failed.
Cheers, Stephan
On Sat, Jan 3, 2015 at 11:44 PM, Christian Henning <chhenning@gmail.com> wrote:
Could you try out the develop branch for gil/extension folder?
Hi Christian, I got the result now and yes, even when using the complete modular tree and development branch of gil it still shows an assertion: sm@hal9001 ~/devel/neuro/build $ tools/test1 input.jpg test1: /home/sm/devel/modular-boost/boost/gil/color_base.hpp:343: typename boost::gil::element_reference_type<boost::gil::detail::homogeneous_color_base<Element, Layout, K> >::type boost::gil::detail::dynamic_at_c(boost::gil::detail::homogeneous_color_base<Element, Layout, K>&, std::size_t) [with Element = signed char; Layout = boost::gil::layout<boost::mpl::vector1<boost::gil::gray_color_t> >; int K = 1; typename boost::gil::element_reference_type<boost::gil::detail::homogeneous_color_base<Element, Layout, K> >::type = signed char&; std::size_t = long unsigned int]: Assertion `i<K' failed. I have my slightly updated test attached for reference. HTH, Stephan
participants (2)
-
Christian Henning
-
Stephan Menzel