This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug fortran/35267] New: VOLATILE constrain: Misleading error message "Incompatible ranks"


Spit off from PR 35033. The following is wrong but for different reasons. The
error message is thus very difficult to deceiver:

          p = q
          1
Error: Incompatible ranks 2 and 1 in assignment at (1)

gfortran regards it as intrinsic assignment which fails due to the different
ranks. However, it is actually a non-intrinsic assignment and it only fails
because the argument to the ASSIGNMENT(=) subroutine is a pointer and the dummy
is VOLATILE.

The problem is that the checking is done via "try whether interface matches"
and if it fails it is ignored and the next generic interface is tried. One
should actually check whether it matches - and if it does, additional
constrains need to be checked - such as this VOLATILE problem.

Detailed description of the test case, see PR 35033. compare_actual_formal
should be modified such that there is first a loop of arguments which checks
whether the all arguments match to the interface. Then another loop which runs
again over all arguments and checks whether additional constrains are violated.
For the first one, one simply returns when matching GERNERIC procedures
(assignments, operators) while in the second loop one prints out an error
message unconditionally.


The test case itself is:

          INTERFACE ASSIGNMENT(=)
             SUBROUTINE s(a,b)
                 REAL,INTENT(OUT),VOLATILE :: a(1,*)
                 REAL,INTENT(IN) :: b(:)
             END SUBROUTINE
          END Interface
          REAL,POINTER :: p(:,:),q(:)
          CALL s(p,q)    ! Violation of constraint C1233 [271:9-11],
                         !  associating P with A
          p = q          ! No constraint violation because <actual-arg>
                         !  syntax is not being used
          end


-- 
           Summary: VOLATILE constrain: Misleading error message
                    "Incompatible ranks"
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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