最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

intel fortran - Force error on warning when compiling with ifxifort? - Stack Overflow

programmeradmin4浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论