http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56849



             Bug #: 56849

           Summary: Missing compile-time shape check for RESHAPE

                    assignments

    Classification: Unclassified

           Product: gcc

           Version: 4.9.0

            Status: UNCONFIRMED

          Keywords: accepts-invalid, diagnostic

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: bur...@gcc.gnu.org





The following code is invalid as one assigns a [1,2] array to a [2,1] variable.



NAG properly diagnoses this at compile time:

Error: test.f90, line 3: Array shapes differ in dimension 1 (extent 2 and 1)



gfortran doesn't but fails at runtime:

Fortran runtime error: shape and target do not conform





integer :: x(2,2),y(4)

y = reshape([1,2,3,4],[4])

x(:,1:1) = reshape(y(::2), [1,2])

print *, y

print *, x(:,1)

end

Reply via email to