The following self-contained code should print the same for the bounds of xxx and yyy (0:12). Instead it prints
bounds of yyy= 0 12 bounds of xxx= 1 13 % gfortran --version GNU Fortran (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) This causes the current version of the Community Atmosphere Model (CAM), and WRF 2.2.1 to fail. The code sample works as expected with PGI, XLF, and ifort. This is my first bugzilla report. Apologies in advance if I missed any required steps in reporting this bug. To build and run: % gfortran main.f90 % ./a.out ------------------------------------------------------------------------ program main implicit none real, target :: yyy(0:12) data yyy/1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13./ real, pointer :: xxx(:) xxx => yyy write(6,*)'bounds of yyy=',lbound(yyy), ubound(yyy) write(6,*)'bounds of xxx=',lbound(xxx), ubound(xxx) end program main -- Summary: gfortran generates incorrect lbound and ubound Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: major Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rosinskijm at ornl dot gov GCC build triplet: i686-pc-linux GCC host triplet: i686-pc-linux GCC target triplet: i686-pc-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37317