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

stdlib_*laset add array bound checks in presence of hardcoded input address #836

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

perazz
Copy link
Contributor

@perazz perazz commented Jun 15, 2024

Fix #835. Calls like this

call stdlib_slaset( 'U', nr-1,nr-1, zero,zero, a(1,2),lda )

cause bound checking errors in debug mode in case nr==1 because size(a,2)==1 (internally, nothing would be executed).

In several other places, LAPACK already had this fixed i.e., at:

                    ! zero out below r
                    if( n > 1 ) then
                       call stdlib_slaset( 'L', n-1, n-1, zero, zero, a( 2, 1 ),lda )
                    end if

i.e. by simply requiring n>1. This PR extends this safety checks to all applicable cases, i.e. where argument a address is hard-coded. A test is added too.

cc: @jvdp1 @jalvesz @loiseaujc @fortran-lang/stdlib

extend to all routines; add test

add test

extend checks to all routines where applicable

Revert "fix test"

This reverts commit de9a53d024aba03bbcb1741a674ccd578c8d9236.

Reapply "fix test"

This reverts commit ffe726d1bb9861eb15a7c46cc40d74de3cb9c0bb.

Revert "Reapply "fix test""

This reverts commit 720ce1199e9bf965ad43834fd1df3af17e1ae57d.

add checks everywhere applicable
Copy link
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you @perazz

@perazz
Copy link
Contributor Author

perazz commented Jun 17, 2024

Thank you @jvdp1. Let's wait one or two days, and then merge if there are no further comments.

@perazz perazz merged commit ad42828 into fortran-lang:master Jun 19, 2024
17 checks passed
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.

svd not working for matrices with a single column
2 participants