they were meticulous in what they were doing, how can it be a "bug"?

I keep hitting behaviour that is very weird.
Having compiled the following program into an executable
#include <stdio.h> #include <stdlib.h> #include <gsl/gsl_spmatrix.h> #include <gsl/gsl_version.h> int main(int argc, char * argv[]) { long t, initial_value,left_shift, addon; initial_value = strtol(argv[1], NULL, 10); left_shift = strtol(argv[2], NULL, 10); addon = strtol(argv[3], NULL, 10); size_t v = (size_t)initial_value; v <<= (size_t)left_shift; v += (size_t)addon; printf("gsl header version : %s\n", GSL_VERSION); printf("gsl library version: %s\n", gsl_version); printf("size of _size_t is %d bytes\n", sizeof(size_t)); printf("initial value: %d\nleft shift: %d\naddon: %d\n", initial_valu +e, left_shift, addon); gsl_spmatrix *m = gsl_spmatrix_alloc(v,v); printf("size1: %lu\nsize2: %lu\nnz: %lu\n", m->size1, m->size2, m->nz +); return 0; }
I then execute it 4 times with different input arguments:
D:\C>gsl_spm.exe 1 16 28000 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 28000 size1: 93536 size2: 93536 nz: 0 D:\C>gsl_spm.exe 1 16 28001 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 28001 size1: 93537 size2: 93537 nz: 0 D:\C>gsl_spm.exe 1 16 28002 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 28002 size1: 93538 size2: 93538 nz: 0 D:\C>gsl_spm.exe 1 16 29002 gsl header version : 2.7.1 gsl library version: 2.7.1 size of _size_t is 8 bytes initial value: 1 left shift: 16 addon: 29002 gsl: init_source.c:144: ERROR: failed to allocate space for data Default GSL error handler invoked.
The first three runs seem quite sane to me, but I don't see a good reason that the 4th run should blow up like that just because the third command line argument has been raised by 1000.
Maybe it's optimization at the expense of correctness ?
Or maybe there are some mysterious rules of usage that I am overlooking. (I don't normally use the GSL library at all.)
I get the same results with gsl-2.6.1.

Cheers,
Rob

In reply to Re^8: Math::GSL::SparseMatrix is broken if installed on latest 5.32.1.1 "Strawberry Perl PDL edition", whom to report this issue to? by syphilis
in thread Math::GSL::SparseMatrix is broken if installed on latest 5.32.1.1 "Strawberry Perl PDL edition", whom to report this issue to? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.