bugGNU Scientific Library - Bugs: bug #49988, Allocation of zero-length blocks,...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #49988: Allocation of zero-length blocks, vectors, matrices

Submitted by:  Roy Stogner <roystgnr>
Submitted on:  Thu 05 Jan 2017 03:54:06 PM UTC  
 
Category:  Documentation Severity:  3 - Normal
Operating System:  Status:  Need Info
Assigned to:  Rhys Ulerich <rhysu> Open/Closed:  Closed
Release: 

( Jump to the original submission)

Sat 21 Jan 2017 02:39:12 AM UTC, comment #6:

Merged to master in http://git.savannah.gnu.org/cgit/gsl.git/commit/?id=791e302098bc51d057c4fed288e68b26617a9c74

Rhys Ulerich <rhysu>
Project AdministratorIn charge of this item.
Fri 20 Jan 2017 11:45:29 PM UTC, comment #5:

Patrick, any complaints if I merge this into master?

Rhys Ulerich <rhysu>
Project AdministratorIn charge of this item.
Tue 10 Jan 2017 02:27:31 PM UTC, comment #4:

You're correct; for some reason I'd assumed that only vector/matrix/etc returned a struct pointer rather than an array pointer.

Roy Stogner <roystgnr>
Tue 10 Jan 2017 02:37:14 AM UTC, comment #3:

Fixed the changelog spelling in http://git.savannah.gnu.org/cgit/gsl.git/commit/?h=bug49988.

I'm going to leave "a null pointer" because it's not indeterminate within GSL. GSL returns null per GSL_ERROR_VAL macros like those in http://git.savannah.gnu.org/cgit/gsl.git/tree/block/init_source.c?h=bug49988#n21.

Rhys Ulerich <rhysu>
Project AdministratorIn charge of this item.
Mon 09 Jan 2017 11:14:09 PM UTC, comment #2:

Thanks, Rhys!

I'd say "a non-dereferenceable pointer is returned" rather than "a null pointer is returned"; some malloc implementations return the former and some the latter.

The Changelog should read "matrices" and "submatrices" rather than "matrics" and "submatrics".

Otherwise this looks fantastic.

Roy Stogner <roystgnr>
Sat 07 Jan 2017 09:12:03 PM UTC, comment #1:

New branch http://git.savannah.gnu.org/cgit/gsl.git/commit/?h=bug49988 has, I think, a comprehensive pass allowing zero-length blocks, vectors, subvectors, matrices, submatrics, and associated views.

Would someone please review that commit and merge the branch if it's satisfactory? It was enough of a change (and I've been AWOL long enough) that I didn't want to push straight to master.

Interestingly, a wash in new lines of code after adjusting the test coverage.

Rhys Ulerich <rhysu>
Project AdministratorIn charge of this item.
Thu 05 Jan 2017 03:54:06 PM UTC, original submission:

In the documentation for allocation functions at https://www.gnu.org/software/gsl/manual/html_node/Block-allocation.html#Block-allocation and https://www.gnu.org/software/gsl/manual/html_node/Vector-allocation.html#Vector-allocation and https://www.gnu.org/software/gsl/manual/html_node/Matrix-allocation.html#Matrix-allocation

the gsl_*_alloc() functions are described as intended to "follow the style of malloc and free", however there is an important distinction in behavior: malloc handles the "if size is 0" case by returning a NULL or a free()able pointer value; gsl_*_alloc throws a "block length n must be positive integer" exception in init_source.c

I would prefer to fix this by adding support for zero-length objects, which would then obviate the need for special-case code in some of my higher-level algorithms; however I don't know how intrusive that support would need to be or whether others would agree with my preference, so I'm marking this as a "Documentation" bug - a quick resolution would be to simply mention the "n > 0" requirement in the manual.

Roy Stogner <roystgnr>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rhysu (Posted a comment)
  • -email is unavailable- added by roystgnr (Submitted the item)
  •  

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-01-21 rhysu Open/ClosedOpen => Closed
    2017-01-07 rhysu StatusNone => Need Info
        Assigned toNone => rhysu

    Back to the top


    Powered by Savane 3.3