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

Code works in IFORT and IFX/Release but crashes in IFX/Debug

Jarek_T
Novice
1,499 Views

I have the following code:

program line_test   
   implicit none   
   integer :: i, arr(2,5), iv(2)

   do i = 1, 5
      iv = [i,i]
      arr(:,i) = i     ! ok statement
      arr(:,i) = iv    ! ok statement
      arr(:,i) = [i,i] ! statenment crashing the code
   end do
   write(*,*) 'testing succesfull'
end program

It is compiled in debugging mode with the following flags:

/nologo /debug:full /Od /warn:all /module:"x64\Debug\\" /object:"x64\Debug\\" /traceback /check:all /libs:dll /threads /dbglibs /c

When compiled and run  using Intel® Fortran Compiler 2024.0 IFORT I get expected results:

x64\Debug\line_test.exe
 testing succesfull

When compiled in Debug mode  using Intel® Fortran Compiler 2024.0 IFX I get an runtime error:

x64\Debug\line_test.exe
forrtl: severe (408): fort: (11): Subscript #1 of the array ARR has value 0 which is less than the lower bound of 1

Image              PC                Routine            Line        Source
line_test.exe      00007FF75E3F15CE  LINE_TEST                   9  line_test.f90
line_test.exe      00007FF75E3F16FB  Unknown               Unknown  Unknown
line_test.exe      00007FF75E3F1C19  Unknown               Unknown  Unknown
line_test.exe      00007FF75E3F1B32  Unknown               Unknown  Unknown
line_test.exe      00007FF75E3F19EE  Unknown               Unknown  Unknown
line_test.exe      00007FF75E3F1C8E  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FF9EF8F257D  Unknown               Unknown  Unknown
ntdll.dll          00007FF9F058AF28  Unknown               Unknown  Unknown

Code also works fine when compiled in Release mode using Intel® Fortran Compiler 2024.0 IFX compiler with the following flags:

/nologo /O2 /module:"x64\Release\\" /object:"x64\Release\\" /libs:dll /threads /c

 Anybody knows why is the code crashing?

0 Kudos
1 Solution
andrew_4619
Honored Contributor III
1,472 Views

I am pretty sure I posted about a very similar issue not long ago but I am struggling to find it....

[edit: found it]

https://community.intel.com/t5/Intel-Fortran-Compiler/Exception-in-IFX-2024-2-0-Intel-R-64/m-p/1610145#M172758

View solution in original post

9 Replies
andrew_4619
Honored Contributor III
1,473 Views

I am pretty sure I posted about a very similar issue not long ago but I am struggling to find it....

[edit: found it]

https://community.intel.com/t5/Intel-Fortran-Compiler/Exception-in-IFX-2024-2-0-Intel-R-64/m-p/1610145#M172758

Jarek_T
Novice
1,433 Views

Yes it does sound like the same issue, with rather unsatisfactory solution of "I escalated this report to our compiler engineering", but without any info about their findings or plans for fixing it. 

0 Kudos
TobiasK
Moderator
1,403 Views

@Jarek_T 
I think your expectations are too high. The bug was reported not so long ago. It's added to the list of bugs that we will fix. Unfortunately, we also have to prioritize on which bugs to work first. Several factors play a role when prioritizing bugs. As you might know, we also offer priority support for those customer who want to have their bugs assigned and worked on with higher priority.

That being said, we are very happy to take up bugs from the community and are very proud of the Fortran community here.

0 Kudos
Jarek_T
Novice
1,378 Views

You are probably right about my expectations. Only recently I started working again with fortran, and the last couple decades I was working with languages where compiler/interpreter errors are super rare and each one is a big deal. I do not recall ever finding one in python, R, C++ or lua and the last one I found in Matlab was probably 15 years ago.  So it is a bit jarring to find 2 compiler errors in couple months in IFX compiler.  

0 Kudos
andrew_4619
Honored Contributor III
1,354 Views

Moving Forward (Development) = Bugs, a fact of life!

TobiasK
Moderator
1,350 Views

Not finding bugs for decades sound scary to me, smells like a ton of silent bugs.

Jarek_T
Novice
1,337 Views

I agree. Fortran is changing a lot, while trying to be backward-compatible, which sounds like a hard task. I love the new features of the language, which allow creation of much more readable (=maintainable)  code, and those will come at the price of bugs. 

 

Thank you all for the help with this. 

Devorah_H_Intel
Moderator
965 Views

@Jarek_T  - thank you for the report and test case. I have added your test case to the existing internal bug report. There is no fix in the upcoming 2025 release, but we plan on fixing it in future ifx releases. 

0 Kudos
Francesco_F
Novice
489 Views

waiting for the bug fix, you may try using double brackets (it probably depends on the rank of your array):

arr(:,i) = [ [ i,i] ]

It is definitely not a good solution if the problem is repeated in too many lines of your code

Reply