Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28497 Discussions

Compiler bug when options -warn all and -check all are both used

mecej4
Honored Contributor III
683 Views
The following program has origins in a long thread posted recently ("application crashing"), but this short program has no errors as far as I can tell. It runs correctly when compiled by versions 8.1 and 10.1 of IFort on Windows-32 and Linux Itanium. It also runs correctly when only -warn all or only -check all is used with 11.1.067 (Windows XP), 11.1.073 (Linux IA32, Intel64) and 11.1.072 (Linux IA64).

[fortran]PROGRAM KRBUG

implicit none
integer :: IERR

call chk('MKS',iErr)

END PROGRAM KRBUG

SUBROUTINE chk(str,isError)

implicit none
integer :: isERROR
character(len=*) :: str
character(len=len(str)) :: strLower
call Lcase(str,strLower)
write(*,10)strLower
return
10 format(1x,'|',A,'|')

END SUBROUTINE chk

SUBROUTINE Lcase (str, strLower)

implicit none
character(len=*), intent(in) :: str
character(len=len(str)), intent(out) :: strLower
integer :: i

strLower = str
do i = 1, len_trim(str)
if (lge(str(i:i), 'A') .and. lle(str(i:i), 'Z')) &
strLower(i:i) = achar( iachar(str(i:i)) + 32 )
enddo
return

END SUBROUTINE Lcase
[/fortran]

However, with both options chosen (and -traceback added to show line-numbers), with 11.1.067 (Windows XP), 11.1.073 (Linux IA32, Intel64) and 11.1.072 (Linux IA64), it produces a bogus run-time error.

[bash]forrtl: severe (408): fort: (4): Variable STRLOWER has substring ending point 2 which is greater than the vari
able length of 1

Image PC Routine Line Source
kr.exe 00449E0A Unknown Unknown Unknown
kr.exe 00446FF8 Unknown Unknown Unknown
kr.exe 00407BF0 Unknown Unknown Unknown
kr.exe 00408211 Unknown Unknown Unknown
kr.exe 00401248 _LCASE 33 kr.f90
kr.exe 0040106D _MAIN__ 6 kr.f90
kr.exe 0044FDB3 Unknown Unknown Unknown
kr.exe 004345AF Unknown Unknown Unknown
kernel32.dll 7C817077 Unknown Unknown Unknown[/bash]
The bug disappears if the subroutines are converted to internal subprograms.
0 Kudos
4 Replies
pbkenned1
Employee
683 Views
Thanks for the detailed report, that really helps us to narrow down the issue. It's a straight compiler bug and regression to boot (sigh).

This has been reported tothe compiler developersas defect #DPD200160916. I will keep this thread updated with any developments.

The last good compiler is circa late November 2009:

> ifort -V

Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20091130 Package ID: l_cprof_p_11.1.064

> ifort -O0 -warn all -check all T77560.f90 -traceback && ./a.out

T77560.f90(10): remark #7712: This variable has not been used. [ISERROR]

SUBROUTINE chk(str,isError)

-------------------^

|mks|

>

Patrick Kennedy
Intel Developer Support
0 Kudos
pbkenned1
Employee
683 Views
The compiler defect is due to the specific flag combination '-warn interface -check bounds'.

You can workaround the issue by compiling with '-warn all -check all' and adding 'warn -nointerfaces -check nobounds' to exclude only the defective combination (and still get the benefit of all the other diagnostics):

$ ifort -V

Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.0.066 Build 20100825

$ ifort -warn all -warn nointerfaces -check all -check nobounds T77560.f90 && ./a.out

T77560.f90(10): remark #7712: This variable has not been used. [ISERROR]

SUBROUTINE chk(str,isError)

-------------------^

|mks|

$


Patrick Kennedy
Intel Developer Support
0 Kudos
mecej4
Honored Contributor III
683 Views
Thanks, it was not a pressing problem since I had just learned to avoid using those two problem-causing switches together.

Your workaround recommendation is going to help, too.
0 Kudos
pbkenned1
Employee
683 Views
This issue is now resolved in XE Compiler update #1:

$ ifort -V

Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.1.107 Build 20101116

Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

$ ifort -O0 -warn all -check all T77560.f90 -traceback && ./a.out

T77560.f90(10): remark #7712: This variable has not been used. [ISERROR]

SUBROUTINE chk(str,isError)

-------------------^

|mks|

$


As it was a Fortran front-end defect, all platforms were affected. The packages with the fixes are:

w_fcompxe_2011.1.127 (Windows*)
l_fcompxe_2011.1.107 (Linux*)
m_fcompxe_2011.1.122 (Mac OS* X)

Patrick Kennedy
Intel Developer Support
0 Kudos
Reply