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

a bug of intel fortran compiler?

lauhwa
Novice
367 Views

Recently I have tried to use "block/end block". But I found a error when I wrote some data as follow

program main
    implicit none  
    integer::i 
    i=1
    write(*,*)i,'0'
    block 
        integer::j 
        write(*,*)j,'1'
        write(*,'(<i>i8)')j
    end block

end program 

 

then, the fortran compiler return an internal error:

fortcom: Fatal: There has been an internal compiler error (C0000005).

while if I don't use block or replace "<i>I8" by 1I8, no error reported.

The fortran compiler is Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.5.281 Build 20190815 with a student license.

 

0 Kudos
1 Solution
andrew_4619
Honored Contributor II
356 Views

ICE is a compiler bug always but your code is not standard Fortran, the <i> syntax is an extension supported by some compilers. You should not use that '(*(i8))' would be any number or you could build a format at run time.

character(20) :: gf, gtmp
integer :: i
i = 2
write(gtmp,'(i0)' ) i
gf = '('//trim(gtmp)//'(i8))'
write(*,gf) i

 

View solution in original post

3 Replies
andrew_4619
Honored Contributor II
357 Views

ICE is a compiler bug always but your code is not standard Fortran, the <i> syntax is an extension supported by some compilers. You should not use that '(*(i8))' would be any number or you could build a format at run time.

character(20) :: gf, gtmp
integer :: i
i = 2
write(gtmp,'(i0)' ) i
gf = '('//trim(gtmp)//'(i8))'
write(*,gf) i

 

lauhwa
Novice
348 Views

Think you so much! It is better and common way. 

Steve_Lionel
Black Belt Retired Employee
321 Views

If you want the format to be repeated as many times as there are items or elements, then use the format:

'(*(i8))'

 

Reply