The code

subroutine a (emask)
  implicit none
  real, intent(in) :: emask(:,:,:)
  logical :: left(3), right(3)
  integer :: i,j,k
  i=1; j=1; k=1
  left=.false.
  right=.false.
  if (.not.right(3)) left(1) = abs(emask(i,j,k+1)-1)<0.01)
end subroutine a

contains an error in the if statement.  The last closing parenthesis in this
line must not be there.  When compiled with gfortran, the error message is

$ ~/gcc/bin/gfortran --version
GNU Fortran 95 (GCC) 4.1.0 20051030 (experimental)

$ ~/gcc/bin/gfortran -c unclassifyable.f90 
 In file unclassifyable.f90:9

  if (.not.right(3)) left(1) = abs(emask(i,j,k+1)-1)<0.01)
                    1
Error: Unclassifiable statement in IF-clause at (1)

This may be technically correct, but I wonder whether it would be possible to
count parentheses and detect the mismatch.  I'm aware of the fact that
classifying statements in Fortran requires e.g. looking for equal signs and
commas that are not enclosed in parentheses, so that mismatching parantheses
can throw the classifier off.  But the classifier probably already contains
parentheses matching code, and reporting the mismatch would lead to a better
error message.


-- 
           Summary: Unclear error message
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schnetter at aei dot mpg dot de
 GCC build triplet: powerpc-apple-darwin8.3.0
  GCC host triplet: powerpc-apple-darwin8.3.0
GCC target triplet: powerpc-apple-darwin8.3.0


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

Reply via email to