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

Intel support for Named IF block in Fortran 2008

DataScientist
Valued Contributor I
489 Views

Consider the following simple Fortran program:

program testNamedIfBlock

implicit none

integer :: i, counter

test: if (.true.) then
    write(*,*) 'Hello World!'
    exit test
else test
end if test
    
end program testNamedIfBlock

Compiling this code with Intel's ifort compiler 2018 on both Linux and Windows leads to internal compiler error:

$ifort main.f90 -o a.out
main.f90: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for main.f90 (code 1)

Commenting the line

exit test

leads to error-free successful compilation of the code. Is this a compiler bug, or is it simply because named if block is not yet supported in ifort? It looks like the named BLOCK constructs are already supported, so it seems an oddity if named IF constructs are not yet supported.

0 Kudos
1 Reply
IanH
Honored Contributor III
489 Views

An internal compiler error is always a compiler bug. 

You could lodge a support ticket for this, though it has been reported previously.  The error still exists in the current beta.

(Named constructs have been around since Fortran 90, it the ability to name them in an exit statement that is new.)

0 Kudos
Reply