http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49479
Summary: [4.6/4.7 Regression] reshape / optionals / zero sized arrays Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: joost.vandevond...@pci.uzh.ch Currently, CP2K seems miscompiled with the 4.6 and 4.7 branches. The following testcase is likely the issue: MODULE M1 IMPLICIT NONE CONTAINS SUBROUTINE S1(data) INTEGER, DIMENSION(:), INTENT(IN), & OPTIONAL :: DATA IF (PRESENT(data)) WRITE(6,*) SIZE(data) END SUBROUTINE SUBROUTINE S2(N) INTEGER :: N INTEGER, ALLOCATABLE, DIMENSION(:, :) :: blki ALLOCATE(blki(3,N)) blki=0 CALL S1(RESHAPE(blki,(/3*N/))) END SUBROUTINE END MODULE USE M1 CALL S2(0) END whereas gfortran 4.5 prints correctly 0, 4.6/4.7 print nothing.