This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

request for a better error message


Hi
   Sometimes the error messages generated by gfortran are very concise
and is difficult to figure for the casual eye. In particular consider
the following case

program initialize
  implicit none
  integer, parameter :: DP = kind(1.0d0)
  real(DP) :: array1(1:3)

  ! The following statement is not standard conforming.
  ! But the error generated is very cryptic and difficult to understand.
  array1 = (/ 2.3_dp, 3.4, 7.1 /)
end program initialize

When compiled with 

$gfortran -v
Using built-in specs.
Target: i386-linux
Configured with: ../gcc/configure --prefix=/tmp/gfortran-20050425/irun
--enable-languages=c,f95 --host=i386-linux
Thread model: posix
gcc version 4.1.0 20050425 (experimental)

$gfortran -static initialize.f90
 In file initialize.f90:8

  array1 = (/ 2.3_dp, 3.4, 7.1 /)
                    1
Error: Element in REAL(8) array constructor at (1) is REAL(4)

Along with the above error message, if we can add aline saying that,
"the elements in an array constructor should be of the same type" then
it would be very obvious for the user to figure out the mistake.

What do others think?

raju

-- 
http://groups-beta.google.com/group/mpich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]