[Bug fortran/38859] New: ubound and lbound treat structure component references as whole arrays

dick dot hendrickson at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 15 19:47:00 GMT 2009


The UBOUND and LBOUND intrinsics treat a reference to an array structure
component as if they were inquires on a whole array.  

Dick Hendrickson


       program try_jg_15_18

! fails on Windows XP
! gcc version 4.4.0 20081219 (experimental) [trunk revision 142842] (GCC)

       type x
         integer I
       end type x
       type (x) A(0:5, 2:8)
       integer ida(2)

       ida = lbound(a)
       if (any(ida /= (/0,2/))) print *, 'base array', ida

!note that a%i is neither a whole array nor an array structure component

       ida = lbound(a%i)
       if (any(ida /= (/1,1/))) print *, 'lbound    ', ida

       ida = ubound(a)
       if (any(ida /= (/6,7/))) print *, 'ubound    ', ida

       end


C:\gfortran>gfortran try_jg_15_18.f

C:\gfortran>a
 lbound               0           2
 ubound               5           8


-- 
           Summary: ubound and lbound treat structure component references
                    as whole arrays
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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



More information about the Gcc-bugs mailing list