I'm seeing some oddness (which may be my fault) but I'm not sure where to go from here.
The symptom is a crash in makecolortx when using a 'fixnan' option, but as I went to investigate things started going all crazy on me. It feels a bit like memory corruption, but I've ran this all in valgrind and nothing pops up.
The outer-most symptom (other than the crash) is that I'm getting different results for using the
ImageBuf::Iterator array [] syntax, vs the ImageBuf.getchannel() call.
/net/homedirs/jeremys/svn/makecolortx
./_spinux1_gcc44m64_D/makecolortx_d -o /tmp/a.exr dev.mtl_lgts_dougs_sphere_aov_test_sphere_aov_test_v1_tvfa_lnf.0001.exr --fixnan box3
Where the relevant code is...
`ImageBuf dst
ImageBuf::Iterator pixel(dst);
while (pixel.valid()) {
for (int c = 0; c < spec.nchannels; ++c) {
float value = pixel[c];
float value2 = src.getchannel(pixel.x(), pixel.y(), c);
if(isfinite(value)!= isfinite(value2))
{
std::cerr << "ERROR" << std::endl;
...`
OUTPUT: ERROR value -nan value2 1 x 591 y 546 c 3
When I run this through valgrind, there is a bit of suspiciousness:
`==821== Invalid read of size 4
==821== at 0x42A4A4: float OpenImageIO_Arnold::v0::convert_type<float, float>(float const&) (fmath.h:434)
==821== by 0x4277EC: OpenImageIO_Arnold::v0::DataProxy<float, float>::operator float() const (fmath.h:485)
==821== by 0x41C971: fixnan_box3(int_, int_, OpenImageIO_Arnold::v0::ImageBuf&, OpenImageIO_Arnold::v0::ImageBuf const&) (makecolortx.cpp:595)
==821== by 0x41F949: make_texturemap(char const_) (makecolortx.cpp:1139)
==821== by 0x422553: main (makecolortx.cpp:1503)
==821== Address 0xadca2d0 is 0 bytes after a block of size 2,568,960 alloc'd
==821== at 0x4C25A0E: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==821== by 0x42E534: gnu_cxx::new_allocator::allocate(unsigned long, void const) (new_allocator.h:89)
==821== by 0x42CCC4: std::Vector_base<char, std::allocator >::M_allocate(unsigned long) (stl_vector.h:140)
==821== by 0x5089468: std::vector<char, std::allocator >::M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator > >, unsigned long, char const&) (vector.tcc:414)
==821== by 0x5086271: std::vector<char, std::allocator >::insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator > >, unsigned long, char const&) (stl_vector.h:851)
==821== by 0x5083EBD: std::vector<char, std::allocator >::resize(unsigned long, char) (stl_vector.h:557)
==821== by 0x50710E5: OpenImageIO_Arnold::v0::ImageBuf::realloc() (imagebuf.cpp:143)
==821== by 0x5071EEC: OpenImageIO_Arnold::v0::ImageBuf::read(int, int, bool, OpenImageIO_Arnold::v0::TypeDesc, bool ()(void, float), void) (imagebuf.cpp:256)
==821== by 0x41E04B: make_texturemap(char const) (makecolortx.cpp:936)
==821== by 0x422553: main (makecolortx.cpp:1503)
==821==
==821== Conditional jump or move depends on uninitialised value(s)
==821== at 0x41C9D5: fixnan_box3(int_, int_, OpenImageIO_Arnold::v0::ImageBuf&, OpenImageIO_Arnold::v0::ImageBuf const&) (makecolortx.cpp:598)
==821== by 0x41F949: make_texturemap(char const*) (makecolortx.cpp:1139)
==821== by 0x422553: main (makecolortx.cpp:1503)
==821==
ImageBuf temp local allocation: 6301440
ImageBuf local allocation: 1572480
`
It says that my code depends on an uninitialized value:
if(isfinite(value)!= isfinite(value2))
but both are set directly above:
float value = pixel[c]; float value2 = src.getchannel(pixel.x(), pixel.y(), c);
Also, I've gotten other weirdness (like crashes in boost) when building a debug makecolortx against an opt OIIO, and vice-versa. As far as I know, this should be completely legit. Am I mistaken?
I know I havent provided a simple test-case, please let me know what you'd like me to test... ;)