Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Comunicados
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29283 Discussões

Ifx fails to bound check for zero sized allocatable arrays

WiserOrb
Novato
2.760 Visualizações

Ifx and ifort compilers fail to detect the out of bounds access for zero sized allocatable array.

Gfortran manages to detect it.

 

ifx version 2024.2.1

main.f90

program main
  integer, allocatable :: a(:)
  
  allocate(a(0))
  
  a(2) = 5
  
  write(*,*) size(a)
end program

Ifx fails to detect the error

ifx main.f90 -check all; ./a.out
           0

 

Gfortran correctly detect the error

gfortran main.f90 --check=all; ./a.out
At line 6 of file main.f90
Fortran runtime error: Index '2' of dimension 1 of array 'a' above upper bound of 0

Error termination. Backtrace:
#0  0x7f3e38025cda in ???
#1  0x7f3e380267d9 in ???
#2  0x7f3e38026d69 in ???
#3  0x40131d in ???
#4  0x40140d in ???
#5  0x7f3e37c2a33f in ???
#6  0x7f3e37c2a408 in ???
#7  0x4010e4 in _start
	at ../sysdeps/x86_64/start.S:115
#8  0xffffffffffffffff in ???

 

0 Kudos
1 Solução
Xiaoping_D_Intel
Funcionário
2.695 Visualizações

It is a known bug CMPLRLLVM-59156 which has already been fixed. The fix will be available in a future release. 

Ver solução na publicação original

7 Respostas
Xiaoping_D_Intel
Funcionário
2.696 Visualizações

It is a known bug CMPLRLLVM-59156 which has already been fixed. The fix will be available in a future release. 

Arjen_Markus
Colaborador honorário II
2.077 Visualizações

I have run into this problem with Intel Fortran oneAPI 2025.0.0. Has this become available in the current version?

Xiaoping_D_Intel
Funcionário
1.865 Visualizações

The fix has been available since oneAPI 2025.1.0.

Arjen_Markus
Colaborador honorário II
1.814 Visualizações

Thanks, I was wondering as the original post about it having been fixed was from before 2025.0.0. 

JohnNichols
Colaborador valorado III
1.770 Visualizações
JohnNichols
Colaborador valorado III
1.770 Visualizações

It compiles without complaint, but will not run, nor if I make a(10) will it run

Steve_Lionel
Colaborador honorário III
1.758 Visualizações
D:\Projects>ifx /check:all t.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2025.2.0 Build 20250605
Copyright (C) 1985-2025 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.43.34809.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:t.exe
-subsystem:console
t.obj

D:\Projects>t.exe
forrtl: severe (408): fort: (10): Subscript #1 of the array A has value 2 which is greater than the upper bound of 0

Image              PC                Routine            Line        Source
t.exe              00007FF6B8E912C3  Unknown               Unknown  Unknown
t.exe              00007FF6B8E98D6B  Unknown               Unknown  Unknown
t.exe              00007FF6B8EC95C0  Unknown               Unknown  Unknown
KERNEL32.DLL       00007FFD726DE8D7  Unknown               Unknown  Unknown
ntdll.dll          00007FFD7403C34C  Unknown               Unknown  Unknown

D:\Projects>
Responder