https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70953
Bug ID: 70953 Summary: Reallocation on assignment does not work with debug flags Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mrestelli at gmail dot com Target Milestone: --- The attached code produces a runtime error when compiled with some debug flags (see later). The code however is correct: the dimension mismatch reported by the compiler is not an error but should trigger the allocation of the rhs. program p implicit none integer, allocatable :: v(:), x(:) allocate( x(3) ) v = int( x ) ! runtime error !v = x ! works correctly write(*,*) shape(v) end program p $ gfortran gf.f90 -g -O0 -fcheck=all -ffpe-trap=invalid -o gf $ ./gf At line 7 of file gf.f90 Fortran runtime error: Array bound mismatch for dimension 1 of array 'v' (7233114627794677618/3) $ gfortran --version GNU Fortran (GCC) 7.0.0 20160422 (experimental) Removing either -fcheck=all or -ffe-trap=invalid solves the problem.