https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65825

            Bug ID: 65825
           Summary: Cannot change attributes intrinsic
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: roger.ferrer at bsc dot es

Hi,

a problem similar to PR57141 happens with the code below.

Fails both with gfortran 4.9.2 and 5.0.1 20150412 (prerelease).

Both Intel Fortran 14.0.2 and XL Fortran 15.01 accept this code (both print 3
of course).

-- t.f90
MODULE moo
    IMPLICIT NONE
    INTEGER(4), PUBLIC :: c(3, 3)
    !! uncomment the following statement
    !! as a workaround
    ! PRIVATE :: ubound
    DATA c(3, 1:ubound(c, 2)) / 1, 2, 3 /
END MODULE moo

PROGRAM main
    USE moo
    IMPLICIT NONE
    INTEGER(4) :: x
    INTRINSIC :: ubound ! gfortran rejects this

    x = ubound(c, 2)
    ! should print 3
    PRINT *, x
END PROGRAM main
-- end of t.f90

Leaving the upper bound of the subscript-triplet can be used as a workaround.
Another workaround involves explicitly stating that ubound name is private.

I assume that the code is OK since in both cases ubound does not change its
"intrinsic" meaning.

Kind regards,

Reply via email to