[PATCH] Pr fortran/68153 -- Enhance checking of RESHAPE shape arg

Dominique d'Humières dominiq@lps.ens.fr
Mon Nov 2 16:28:00 GMT 2015


Steve,

The error for the test

program p
   integer, parameter :: sh(2) = [2, 2]
   integer, parameter :: a(2,2) = reshape([1, 2, 3, 4], -sh)
   print *, a
end

is

pr68153_2.f90:2:34:

    integer, parameter :: sh(2) = [2, 2]
                                  1
Error: 'shape' argument of 'reshape' intrinsic at (1) has negative element (-2)

I am pretty sure that some day a user will complain about a confusing error message!-(

Dominique



More information about the Fortran mailing list