-
Notifications
You must be signed in to change notification settings - Fork 444
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
Some tests fail when compiled with -fcheck=bounds #512
Comments
Ah, the joy of passing character from C to Fortran.
then we use LAPACKE lapack/LAPACKE/src/lapacke_dgels.c Line 36 in 1827da0
that calls the work layer at linelapack/LAPACKE/src/lapacke_dgels.c Line 73 in 1827da0
the work layer is here: lapack/LAPACKE/src/lapacke_dgels_work.c Line 36 in 1827da0
Finally we call LAPACK at: lapack/LAPACKE/src/lapacke_dgels_work.c Line 86 in 1827da0
And here is LAPACK: Line 183 in 1827da0
Seems like the |
Yes, I agree. I forgot about #440. Maybe we can continue discussing from there. |
Most Fortran compilers (all current ones that I have encountered) add a strlen argument for each character string to the end of the argument list. For instance, in LAPACK++ we have:
The wrapper calls this with a strlen of 1:
This has been fixed in LAPACK++ but not yet in BLAS++. The better fix would be to write a Fortran routine using the Fortran 2003 bind(C) interface, which handles the C => Fortran string conversion in a Fortran-sanctioned way. E.g., adding an LAPACKE_stptrs_fortran wrapper written in Fortran 2003: LAPACKE_stptrs => LAPACKE_stptrs_work => LAPACKE_stptrs_fortran => stptrs_ In the past, I think some Fortran compilers stuck the strlen as an argument immediately after the string, e.g.,
Also in the past, there were some Fortran compilers that had a struct, maybe something like:
I can't find references for these last 2 conventions at the moment, and I haven't run into them in practice. Mark |
One caution: with the added strlen arguments, your Fortran prototypes won't match other folks' strlen arguments (say, in MKL, ESSL). So be careful to not put them in public headers that would get included along with, say, mkl.h. For instance, in LAPACK++ Mark |
For CBLAS, it seems cblas_f77.h is fine for that purpose — as far as I can see, it isn't included via cblas.h, and is only included in CBLAS/src/*.c
|
Thanks @mgates3 ! I will try your suggestions in the following commit here. |
I am writing #515 to try solving this issue. |
Some tests fail when compiled with -fcheck=bounds.
The errors are:
So far I couldn't find any problems during the debug.
Travis results: https://github.com/weslleyspereira/lapack/runs/2098841918
Branch: https://github.com/weslleyspereira/lapack/tree/try-flag--fcheck=bounds
The text was updated successfully, but these errors were encountered: