public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37317]  New: gfortran generates incorrect lbound and ubound
@ 2008-09-01 18:39 rosinskijm at ornl dot gov
  2008-09-01 19:04 ` [Bug fortran/37317] " kargl at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rosinskijm at ornl dot gov @ 2008-09-01 18:39 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/37317] gfortran generates incorrect lbound and ubound
  2008-09-01 18:39 [Bug fortran/37317] New: gfortran generates incorrect lbound and ubound rosinskijm at ornl dot gov
@ 2008-09-01 19:04 ` kargl at gcc dot gnu dot org
  2008-09-01 19:37 ` rosinskijm at ornl dot gov
  2008-09-02  5:44 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-09-01 19:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kargl at gcc dot gnu dot org  2008-09-01 19:02 -------
The correct result is given by both 4.3.2 and 4.4.0.  You 
may want to upgrade to a newer version of the compiler
because few if any patches will make it back to the 4.2 branch.

troutmask:sgk[204] ./z
 bounds of yyy=           0          12
 bounds of xxx=           1          13
troutmask:sgk[205] gfortran43 -o z j.f90
troutmask:sgk[206] ./z
 bounds of yyy=           0          12
 bounds of xxx=           0          12
troutmask:sgk[207] ~/work/4x/bin/gfortran -o z j.f90
troutmask:sgk[208] ./z
 bounds of yyy=           0          12
 bounds of xxx=           0          12


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/37317] gfortran generates incorrect lbound and ubound
  2008-09-01 18:39 [Bug fortran/37317] New: gfortran generates incorrect lbound and ubound rosinskijm at ornl dot gov
  2008-09-01 19:04 ` [Bug fortran/37317] " kargl at gcc dot gnu dot org
@ 2008-09-01 19:37 ` rosinskijm at ornl dot gov
  2008-09-02  5:44 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: rosinskijm at ornl dot gov @ 2008-09-01 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rosinskijm at ornl dot gov  2008-09-01 19:36 -------
Thank you for the quick response. Glad the bug is fixed in newer releases. Feel
free to close the bug, or is the reporter supposed to do that?


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/37317] gfortran generates incorrect lbound and ubound
  2008-09-01 18:39 [Bug fortran/37317] New: gfortran generates incorrect lbound and ubound rosinskijm at ornl dot gov
  2008-09-01 19:04 ` [Bug fortran/37317] " kargl at gcc dot gnu dot org
  2008-09-01 19:37 ` rosinskijm at ornl dot gov
@ 2008-09-02  5:44 ` burnus at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-02  5:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-09-02 05:43 -------
(In reply to comment #2)
> Thank you for the quick response. Glad the bug is fixed in newer releases. Feel
> free to close the bug, or is the reporter supposed to do that?

Well, in principle it does not matter who closes the bug ;-)

Binary versions of the nightly builds of GCC/gfortran 4.4 are downloadable at:
http://gcc.gnu.org/wiki/GFortranBinaries

Your Linux distribution might have also newer GCCs available (4.3.x); if I read
http://ubuntuforums.org/showthread.php?t=720826
correctly, there exists a gcc-snapshot package. (And intrepid should contain it
by default.)


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |WORKSFORME


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-09-02  5:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-01 18:39 [Bug fortran/37317] New: gfortran generates incorrect lbound and ubound rosinskijm at ornl dot gov
2008-09-01 19:04 ` [Bug fortran/37317] " kargl at gcc dot gnu dot org
2008-09-01 19:37 ` rosinskijm at ornl dot gov
2008-09-02  5:44 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).