Skip to content

Fix wrong index when writing to array#5

Merged
edisongustavo merged 1 commit into
ESSS:masterfrom
michael-hartmann:fix
Dec 13, 2016
Merged

Fix wrong index when writing to array#5
edisongustavo merged 1 commit into
ESSS:masterfrom
michael-hartmann:fix

Conversation

@michael-hartmann
Copy link
Copy Markdown
Contributor

This commit fixes a bug: At one point the index when writing to the array rlist
was wrong. The original QUADPACK code looks like:

80   small = 0.375d+00
     erlarg = errsum
     ertest = errbnd
     rlist2(2) = area
90 continue

As arrays start with index 0 in C, the access of rlist2 should look like:

rlist[1] = area;

This change also fixes undeterministic behavior of the function dquadi due to a
use of uninitialized value. With this fix the memory access seems fine and
LLVM's MemorySanitizer does no longer complain.

This commit fixes a bug: At one point the index when writing to the array rlist
was wrong. The original QUADPACK code looks like:

    80   small = 0.375d+00
         erlarg = errsum
         ertest = errbnd
         rlist2(2) = area
    90 continue

As arrays start with index 0 in C, the access of rlist2 should look like:

    rlist[1] = area;

This change also fixes undeterministic behavior of the function dquadi due to a
use of uninitialized value. With this fix the memory access seems fine and
LLVM's MemorySanitizer does no longer complain.
@edisongustavo
Copy link
Copy Markdown
Contributor

Nice, good catch!

@edisongustavo edisongustavo merged commit bfa7968 into ESSS:master Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants