I recently encountered an ICE (catastrophic error: **Internal compiler error: segmentation violation signal raised**) when trying to compile this code in modern Fortran with ifort 126.96.36.1994. With gfortran it compiles without error.
If I replace n-1 by its value in the spread function it compiles without error with ifort as well.
program test implicit none integer, parameter :: n = 5 real :: array(n) = [1, spread(2,1,n-1)] ... end program
If you have access to Intel Online Support Center (OSC), please submit a support request with a high priority - see below also as to why:
So you may know Intel now offers Intel oneAPI toolkits where Fortran compilers - IFORT classic and new IFX - are free. oneAPI 2021.3 is the latest offering:
What you will find is the ICE you report with SPREAD is not encountered with this 2021.3 Release but there is another problem which a Fortranner might see as far worse i.e., the wrong result is produced:
integer, parameter :: n = 5 real :: a(n) = [ 1, spread(2,1,n-1) ] print *, "a = ", a end
C:\Temp>ifort /standard-semantics a.f90 Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.3.0 Build 20210609_000000 Copyright (C) 1985-2021 Intel Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 14.29.30038.1 Copyright (C) Microsoft Corporation. All rights reserved. -out:a.exe -subsystem:console a.obj C:\Temp>a.exe a = 1.000000 0.000000 0.000000 0.000000 0.000000 C:\Temp>
Hence my hope this can be brought to Intel's attention and for the Intel Fortran team to review the issue urgently. These are the kind of troubling issues where a software provider ideally will deliver a hotfix. Unfortunately that does not seem to be part of the Intel workflow with IFORT.
@FortranFan , thank you for your answer. Following your suggestion I tried submitting it to the OSC but I got this message :
"Support for the product selected is through the Intel Community Forums."
And it was impossible to send my support request.
The internal compiler error reported using SPREAD() is fixed in the Fortran compiler that was released this week. ifort 2021.5.0 is part of oneAPI HPC Toolkit 2022.1. AND SPREAD() does the right thing.
Please try it out!