https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85816
Bug ID: 85816 Summary: nested spread fails with "Integer overflow in xmallocarray" Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: m.diehl at mpie dot de Target Milestone: --- I'm having trouble with nested spread statements on GCC 8.1.0 (Linux 4.16.8-1-ARCH). The same code runs on GCC 7.3.0 (Linux 4.4.0-98-generic). A seemingly unnecessary set of brackets cures the following error: Operating system error: Cannot allocate memory Integer overflow in xmallocarray when running the following code program test implicit none real(8), dimension(3,3) :: tensor = 4.0 integer, dimension(3) :: grid= 16 write(6,*) spread(spread(tensor,3,grid(1)),4,grid(2)) ! ok write(6,*) spread((spread(spread(tensor,3,grid(1)),4,grid(2))),5,grid(3)) ! ok (note the brackets) write(6,*) spread(spread(spread(tensor,3,grid(1)),4,grid(2)),5,grid(3)) ! not ok end program