[Bug fortran/60091] New: Misleading error messages in rank-2 pointer assignment to rank-1 target

loximann at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 6 08:22:00 GMT 2014


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

            Bug ID: 60091
           Summary: Misleading error messages in rank-2 pointer assignment
                    to rank-1 target
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: loximann at gmail dot com

Compiler version: 4.9.0 20130917 (experimental) [trunk revision 202647]

Test program:

program test
    real, target :: a(9)=1.
    real, pointer :: p(:,:)

    p(:,:)=>a          ! (a) Error: Lower bound has to be present at (1)
    p(1:,1:)=>a        ! (b) Error: Different ranks in pointer assignment at
(1)
    p(1:3,1:)=>a       ! (c) Error: Either all or none of the upper bounds must
be specified at (1)
    p(1:3,1:3)=>a

end program

According to Note 7.48, "It is possible to obtain different-rank views of parts
of an object by specifying upper bounds in pointer assignment statements."

In my opinion, the error in all (a), (b) and (c) should be in the lines of
"Different ranks in pointer assignment at (1). All lower and upper bounds must
be specified".



More information about the Gcc-bugs mailing list