This is a remarkably trivial question, but clearly I am missing something: I just want compilation of the below FORTRAN program to fail when compiling with ifx
/ifort
if a warning is thrown. I have checked the documentation, but the -warn all,errors
flag does not work as expected. What flags do I need to accomplish this?
! @file: warning.f90
program warning_example
implicit none
integer :: x, y
x = 10
! y is declared but never used, which should trigger a warning
print *, 'Value of x:', x
end program warning_example
Checking the intel docs for -warn, where the syntax is described as
Syntax Linux: -warn [keyword[, keyword...]]
I would expect
ifort warning.f90 -warn all,errors
to error, however only
warning.f90(5): remark #7712: This variable has not been used. [Y] INTEGER :: x, y ------------------^
gets output and a binary is still is produced.
Similarly, compiling with ifx
yields the same result. ifx
is on my local system and is version ifx (IFX) 2025.0.4
while ifort
is on a cluster I am using and is version ifort (IFORT) 2021.3.0
.
Compilation fails as expected when calling something like
# gfortran --version --> GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
gfortran warning.f90 -Wall -Werror
with