-
Notifications
You must be signed in to change notification settings - Fork 194
test for standard conformance #205
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
Conversation
also one quick fix: complex => cmplx note that the current code does not compile Intel compiler: /tmp/stdlib/build/src/stdlib_experimental_linalg_diag.f90(7): error #6645: The name of the module procedure conflicts with a name in the encompassing scoping unit. [DIAG_RSP] function diag_rsp(v) result(res) GNU compiler /tmp/stdlib/src/tests/optval/test_optval.f90:252:15: 252 | z = optval(x, [2.0_qp, -2.0_qp]) | 1 Error: ‘x’ at (1) is an array and OPTIONAL; IF IT IS MISSING, it cannot be the actual argument of an ELEMENTAL procedure unless there is a non-optional argument with the same rank (12.4.1.5) [-Werror=pedantic]
Martin, thank you and welcome! I think this will be a great step forward. I suggest that we work our way through the errors raised in this PR and fix them until all tests pass. |
In Fortran, are you supposed to use |
|
Another pitfall the compiler should provide a nice error / warning message. Thanks! |
Thank you for starting this. |
For gfortran, the
I'm also not sure if you are even allowed to pass in an optional argument into a function. Is |
I would say for a statically typed language, these warnings are reasonable. Once just has to carefully set the types (5 is not 5.) |
You can pass it to a procedure if the corresponding dummy argument is also declared It looks like we'll need to remove the |
I am currently trying this option. However, we then must check is the actual arguments have the same dimension, and use |
To be honest, I have problems to understand the error of gfortran. What does |
My first impression was that the message was clear (to me at least). To be sure, I went to the gcc source code. /* If it is an array, it shall not be supplied as an actual argument
to an elemental procedure unless an array of the same rank is supplied
as an actual argument corresponding to a nonoptional dummy argument of
that elemental procedure(12.4.1.5). */ , I am doubting. |
Same here. In case that an optional argument is not given, there is still the other argument to determine the properties of the return value. |
From the Fortran Standard (15.5.2.12):
I understand the same from this sentence.
I agree. Btv, which version of gfortran did you use (I used GFortran9.3)? |
10.1 |
This issue related to the Intel compiler should be solved by #208 |
Gfortran issue reported as bug on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95446 |
in general, ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you.
LGTM. For the false positives, would it be possible/adequate to output a warning for the users?
From my side, it was just a general comment that sometimes compilers give warnings despite the code is valid code. For example there are warnings about uninitialized variables even though the the choice of variables of the calling function makes it impossible to use a variable without initialization.
|
I meant such false positives, that are due to, e.g. a bug in the compiler. If someone introduces new procedures in this test, he/she might want to know that these warnings are removed. However, if there is no warnings, he will need to check the CMakefile to know it.
IMO we should go for the 3rd option. The 1st option should never be taken, and the 2nd option should be avoided as much as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for these changes. +1 to merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you, Martin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes seem fine to me. Thanks!
3 positive reviews, merging. |
There are several compiler options that help to detect non-standard conformant code.
I have included some of them (only for Intel and GNU compiler).
Unfortunately, the result is that the code does not compile:
There is also a high number of warnings related to type conversions.