#11754: Computation of rank-decompositions in Sage
-----------------------------+----------------------------------------------
   Reporter:  ncohen         |          Owner:  jason, ncohen, rlm
       Type:  enhancement    |         Status:  needs_review      
   Priority:  major          |      Milestone:  sage-4.8          
  Component:  graph theory   |       Keywords:                    
Work_issues:                 |       Upstream:  N/A               
   Reviewer:  David Coudert  |         Author:  Nathann Cohen     
     Merged:                 |   Dependencies:                    
-----------------------------+----------------------------------------------

Comment(by ncohen):

 Helloooooo !!!

 Patch updated to make the 32 limit clearer `:-)`

 About the segfault : the point is that there is nothing I could "check" to
 return an exception to avoid the segault unless I know where it comes
 from. The function you mention contains a total of 5 lines which can
 produce no segfault, and exclusively consist in memory allocations and
 checking the memory has been allocated
 {{{
 int init_rw(uint_fast8_t n)
 {
         num_vertices = n;
         adjacency_matrix = malloc(sizeof(subset_t) * n);
         slots = malloc(sizeof(uint_fast8_t) * (1ul << n));
         cslots = 0;
         return((adjacency_matrix && slots) ? 0 : -1);
 }
 }}}
 If anything goes wrong, the function return -1 instead of 0. And this
 function (which is defined in the original C code) is called as you said,
 by a "if" that is precisely there to ensure the memory allocation went
 smoothly. If it did not, it also returns and error and the function above
 (rank_decomposition) raises the exception. I mean, there is no memory
 allocation that I could check and that is not checked already `O_o`

 Nathann

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11754#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to