any(A,2) on sparse A causes segfault

David Bateman David.Bateman at motorola.com
Mon Dec 17 10:12:34 CST 2007


Kim Hansen wrote:
> This code makes 2.9.19 crash:
>   A = sprand(42,1856,0.56);
>   a = any(A,2);
>
> The problem has been observed in the Debian package octave2.9 version
> 1:2.9.19-1, and in cvs builds from December the 5th, 11th and 12th.
> The Debian package version 1:2.9.18-1 does not have the problem.
>
> It looks like a problem where octave writes to some memory it
> shouldn't touch, in some cases octave didn't crash on these two lines,
> but crashed on the next line no matter what it was. I have tried to
> debug it by running it through valgrind, but I had no luck. I will add
> the valgrind log below.
>
> Regards,
>   

Kim,

I can confirm that this bug exists. However, this is really hard to
debug as the issue is in  the Sparse-op-defs.h (SPARSE_ANY_OP) macro,
and so the debug won't give valid line number to identify where the bug
is. Also changing Sparse-op-defs.h basically forces a complete rebuild
of Octave. So in an attempt to debug this I created a separate oct-file
with essentially the same code (attached), with the exception that the
any function is a C++ function and no longer a method of the
SparseMatrix class. However, this version of the code shows no bug even
in valgrind..

I'm a bit stumped at the moment and am still trying to figure this one out.

D.

-- 
David Bateman                                David.Bateman at motorola.com
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

-------------- next part --------------
A non-text attachment was scrubbed...
Name: myany.cc
Type: text/x-c++src
Size: 4750 bytes
Desc: not available
Url : https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20071217/4a28d0a4/attachment.bin 


More information about the Bug-octave mailing list