Warning messages -warn iterfaces interpreted as errors

Warning messages -warn iterfaces interpreted as errors

Dear All,

I'm using -warn interfaces (v11.1 ifort compiler on Linux 64 bit) and I was expecting diagnostic messages, but in fact they are eror messages and they terminate the compilation of the file so not generating an object file (and setting the status of the compilation to 1 and thus stopping make). I have not set -warn errors.
Is this a missinterpretation of me ?

Albert

Example:
============================ aa.f90 ==============
subroutine tst_interf(i, r, d)
implicit none

integer :: i
real :: r
double precision :: d
end
============================ bb.f90 ==============
program tst
implicit none

integer :: i
real :: r
real :: d
call tst_interf(i, r, d)
end
=================== commands and output ==========
$ ifort aa.f90 -warn interfaces -c
$ ifort bb.f90 -warn interfaces -c
bb.f90(7): error #6633: The type of the actual argument differs from the type of the dummy argument. [D]
call tst_interf(i, r, d)
------------------------^
compilation aborted for bb.f90 (code 1)

11 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

This is a serious error. If the compiler were to go ahead, any code produced by interprocedural analysis would probably be broken. Even with correct compilation of individual subroutines, you couldn't expect correct run-time behavior across this subroutine call.

Tim,

Do you mean this is a serious error in the compiler.
In my code I made this error on purpose here and it is indeed a serious error (-warn interfaces flags this as it should). There are more errors I get and they are, in my opinion, not serious errors or no errors at all, and thety are flagged as errors as well. Examples are error numbers 8299, 7836.
Furthermore the manual states that diagnostic messages are written out and with an otion -warn (without setting -warn errors) I would expect that the compiler goes on.

Albert

imagem de Steve Lionel (Intel)

I admit that it is a bit confusing that we have collected various categories of compile-time diagnostics under -warn, but not all of these are strictly warnings. For example, "-warn declarations" is the equivalent of IMPLICIT NONE and will give you errors (not warnings) for undeclared variables. Similarly, -warn interfaces enables the compile-time interface checking feature, and mismatches that are normally errors will also be errors here.

Whether the compiler "goes on" or not depends on the side effects of the error. If it prevents a module from being compiled, for example, anything using that module will fail.

Steve

Dear all,

in this message (Wed, 03/23/2011 - 07:08):

Citação:

Steve Lionel (Intel) escreveu:

I admit that it is a bit confusing that we have collected various categories of compile-time diagnostics under -warn, but not all of these are strictly warnings. For example, "-warn declarations" is the equivalent of IMPLICIT NONE and will give you errors (not warnings) for undeclared variables.

[...]

I think this is not true. I am looking for a way to stop compilation when a variable is not declared, and none of the options "-warn declarations" and "-implicitnone" make ifort stop and return a non-zero error status (and therefore stops the makefile).

This is something that I really miss about ifort. I understand that some warnings can be safely ignored and fixed when one has time (I have many of these so I can't use -warn errors), but this one means that ifort has automatically chosen a type and kind that is very likely not to be the correct one (we could make some statistics on how often a programmer intended to use a REAL*4 variable starting with a "A" letter). In other words, except when porting old code to new code, it is not safe to continue when this warning is raised.

imagem de Steve Lionel (Intel)

Interesting - I was sure that we used to make this an error. You can also add "-warn errors" to turn all warnings into errors. Or you can make this specific warning an error with "-diag-error 6717".

Steve

As I said above, I can't use "-warn errors" because I have other "safe" warnings.

I wasn't aware of the option "-diag-error". It works with ifort 13.1.1, i.e. "-warn declarations -diag-error 6717" turns the error status to 1 when needed. Unfortunately it does not work with ifort 11.1, the default version I currently use. The option exists but does not seem to have an effect.

imagem de Steve Lionel (Intel)

Right - that option was new in compiler version 12.0.

Steve

Well, the option "-diag-error" exists in 11.1 (it is recognized on the command line), but it does not seem to work...

For future ifort releases, isn't it possible to make the option "-implicitnone" act as if IMPLICIT NONE statements were added in all procedures? This is what the option suggests but not what it does. This would make procedures with undeclared variables not standard and make full sense to raise an error (since ifort does raise an error if IMPLICIT NONE is present). In other words:

-warn declarations: warn only (as litteraly suggested by the option name)

-implicitnone: raise an error (same as Fortran IMPLICIT NONE)

imagem de Steve Lionel (Intel)

In current releases, you can get exactly the behavior you want with -diag-error 6717 and -warn declarations. No need for yet another option.

Steve

-implicitnone would not be a new option, it already exists. My suggestion was to make it equivalent to "-warn declarations -diag-error 6717", since I believe it is more natural given its name.

Faça login para deixar um comentário.