https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90890
--- Comment #2 from Bharat Mahajan <bharat.mahajan at hotmail dot com> --- (In reply to kargl from comment #1) > (In reply to Bharat Mahajan from comment #0) > > The following program fails with segfault: > > > > program test > > implicit none > > real, dimension(:), allocatable :: a > > integer :: b > > > > a = [a, 2.0] > > b = -100 > > end program test > > > > Compiled it without any option to gfortran on MingW (Win10). If you comment > > out the line "b=-100" then it works! gfortran version: > > > > GNU Fortran (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 > > The code is invalid. In the expression 'a = [a, 2.0]' > you reference 'a' on the RHS when it is undefined. I forgot to mention that code runs with no issues with ifort. Second, then why the following code works with gfortran? --- program test implicit none real, dimension(:), allocatable :: a integer :: b a = [a, 2.0] !b = -100 end program test --- I am not sure I would say 'a' is not defined. It is not allocated yet, that is what the code is trying to do. I have not checked the standards so not sure that the code is trying to do something outside of that, but it works with ifort without their extensions.