https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115150
Bug ID: 115150 Summary: [12/13/14/15 Regression] SHAPE of zero-sized array yields a negative value Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org Target Milestone: --- GCC 11.4 has: Shape: 0 0 Shape: 0 3 0 But since GCC 12: Shape: -2 0 Shape: -3 3 0 Testcase: implicit none real,allocatable :: A(:),B(:,:) allocate(a(3:0), b(5:1, 3)) print *, 'Shape:', shape(a), size(a) print *, 'Shape:', shape(b), size(b) end