Skip to content

Fix access on uninitialized memory#6

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

Fix access on uninitialized memory#6
edisongustavo merged 1 commit into
ESSS:masterfrom
michael-hartmann:fix

Conversation

@michael-hartmann
Copy link
Copy Markdown
Contributor

The original Fortran code looks like (see
http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=quadpack%2Fdqawo.f)

numrl2 = 0
extall = .false.
if(0.5d+00*dabs(b-a)*domega.gt.0.2d+01) go to 10
numrl2 = 1

For this reason the C code should look like
numrl2 = -1;
...
numrl2 = 0;

After this patch LLVM no longer complains about uninitialized access on memory.

The original Fortran code looks like (see
http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=quadpack%2Fdqawo.f)

    numrl2 = 0
    extall = .false.
    if(0.5d+00*dabs(b-a)*domega.gt.0.2d+01) go to 10
    numrl2 = 1

For this reason the C code should look like
    numrl2 = -1;
    ...
    numrl2 = 0;

After this patch LLVM no longer complains about uninitialized access on memory.
@edisongustavo
Copy link
Copy Markdown
Contributor

Seem very reasonable. I compared both codes and this is a correct fix.

Thanks!

(I wonder how people wrote the original fortran code. It is practically unreadable)

@edisongustavo edisongustavo merged commit 0fc8690 into ESSS:master Dec 14, 2016
@michael-hartmann
Copy link
Copy Markdown
Contributor Author

The original Fortran Code is hardly readable... :(

By the way, does the test suite cover all cquadpack functions?

@edisongustavo
Copy link
Copy Markdown
Contributor

By the way, does the test suite cover all cquadpack functions?

I don't know, I've just put the available tests there.

@michael-hartmann
Copy link
Copy Markdown
Contributor Author

Ok. I've compiled all available tests with clang and activaded the memory sanitzer which checks for access of uninitialized memory. So, at least the functions that are called by the tests should be fine.

@michael-hartmann michael-hartmann deleted the fix branch December 16, 2016 12:52
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