Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong index when writing to array #5

Merged
merged 1 commit into from
Dec 13, 2016
Merged

Fix wrong index when writing to array #5

merged 1 commit into from
Dec 13, 2016

Conversation

michael-hartmann
Copy link
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
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