public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34770]  New: Incorrect array indexing through pointer when array does not start at 1
@ 2008-01-13 16:18 michalak at ucar dot edu
  2008-01-13 16:32 ` [Bug fortran/34770] " burnus at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: michalak at ucar dot edu @ 2008-01-13 16:18 UTC (permalink / raw)
  To: gcc-bugs

Have put together a small test program demonstrating the error, which has to do
with indexing of a pointer when the array it points to starts at an index other
than '1'.  The test program, gfortran behavior, and the correct (ifort)
behavior
of the program is listed below.


[michalak@qp ~]$ cat showbad.F90
        PROGRAM showbad
        IMPLICIT NONE
        INTEGER, TARGET :: x(0:12)
        INTEGER, POINTER :: z(:)
        INTEGER i
        DO i = 0,12
          x(i) = i
        ENDDO
        z => x    
        DO i = 0,12
          print*,i,x(i),z(i)
        ENDDO
        END PROGRAM showbad 
[michalak@qp ~]$ gfortran showbad.F90
[michalak@qp ~]$ a.out
           0           0          56
           1           1  <<<      0 <<< wrong
           2           2           1
           3           3           2
           4           4           3
           5           5           4
           6           6           5
           7           7           6
           8           8           7
           9           9           8
          10          10           9
          11          11          10
          12          12          11
[michalak@qp ~]$ ifort showbad.F90
[michalak@qp ~]$ a.out
           0           0           0
           1           1  <<<      1 <<< correct
           2           2           2
           3           3           3
           4           4           4
           5           5           5
           6           6           6
           7           7           7
           8           8           8
           9           9           9
          10          10          10
          11          11          11
          12          12          12

-----------------------------------------------------------
John Michalakes, Software Engineer        michalak@ucar.edu
NCAR, MMM Division                   voice: +1 303 497 8199
3450 Mitchell Lane                     fax: +1 303 497 8181
Boulder, Colorado 80301 U.S.A.        cell: +1 720 209 2320
        http://www.mmm.ucar.edu/individual/michalakes
-----------------------------------------------------------


-- 
           Summary: Incorrect array indexing through pointer when array does
                    not start at 1
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michalak at ucar dot edu


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


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

* [Bug fortran/34770] Incorrect array indexing through pointer when array does not start at 1
  2008-01-13 16:18 [Bug fortran/34770] New: Incorrect array indexing through pointer when array does not start at 1 michalak at ucar dot edu
@ 2008-01-13 16:32 ` burnus at gcc dot gnu dot org
  2008-01-13 16:55 ` john at michalakes dot us
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-13 16:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-01-13 16:17 -------
I can reproduce it in GCC/gfortran 4.1.3 and 4.2.1, but it works in 4.3.0.

Could you try with a newer GCC? http://gcc.gnu.org/wiki/GFortranBinaries


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.1.2 4.1.3 4.2.2
      Known to work|                            |4.3.0


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


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

* [Bug fortran/34770] Incorrect array indexing through pointer when array does not start at 1
  2008-01-13 16:18 [Bug fortran/34770] New: Incorrect array indexing through pointer when array does not start at 1 michalak at ucar dot edu
  2008-01-13 16:32 ` [Bug fortran/34770] " burnus at gcc dot gnu dot org
@ 2008-01-13 16:55 ` john at michalakes dot us
  2008-03-01 12:21 ` fxcoudert at gcc dot gnu dot org
  2008-03-01 12:22 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: john at michalakes dot us @ 2008-01-13 16:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from john at michalakes dot us  2008-01-13 16:43 -------
Subject: RE:  Incorrect array indexing through pointer when array does not
start at 1

Will do. Thanks for the quick response. -John

> -----Original Message-----
> From: burnus at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
> Sent: Sunday, January 13, 2008 9:18 AM
> To: michalak@ucar.edu
> Subject: [Bug fortran/34770] Incorrect array indexing through pointer when
> array does not start at 1
> 
> 
> 
> ------- Comment #1 from burnus at gcc dot gnu dot org  2008-01-13 16:17 ---
> ----
> I can reproduce it in GCC/gfortran 4.1.3 and 4.2.1, but it works in 4.3.0.
> 
> Could you try with a newer GCC? http://gcc.gnu.org/wiki/GFortranBinaries
> 
> 
> --
> 
> burnus at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> ---------------------------------------------------------------------------
> -
>       Known to fail|                            |4.1.2 4.1.3 4.2.2
>       Known to work|                            |4.3.0
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34770
> 
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> You reported the bug, or are watching the reporter.


-- 


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


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

* [Bug fortran/34770] Incorrect array indexing through pointer when array does not start at 1
  2008-01-13 16:18 [Bug fortran/34770] New: Incorrect array indexing through pointer when array does not start at 1 michalak at ucar dot edu
  2008-01-13 16:32 ` [Bug fortran/34770] " burnus at gcc dot gnu dot org
  2008-01-13 16:55 ` john at michalakes dot us
@ 2008-03-01 12:21 ` fxcoudert at gcc dot gnu dot org
  2008-03-01 12:22 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-03-01 12:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2008-03-01 12:20 -------
Subject: Bug 34770

Author: fxcoudert
Date: Sat Mar  1 12:19:04 2008
New Revision: 132801

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132801
Log:
        PR fortran/34770
        * gfortran.dg/pointer_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pointer_1.f90
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/34770] Incorrect array indexing through pointer when array does not start at 1
  2008-01-13 16:18 [Bug fortran/34770] New: Incorrect array indexing through pointer when array does not start at 1 michalak at ucar dot edu
                   ` (2 preceding siblings ...)
  2008-03-01 12:21 ` fxcoudert at gcc dot gnu dot org
@ 2008-03-01 12:22 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-03-01 12:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2008-03-01 12:21 -------
Confirm it was apparently fixed between 4.2 and 4.3.0.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
      Known to work|4.3.0                       |4.3.0 4.4.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

end of thread, other threads:[~2008-03-01 12:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-13 16:18 [Bug fortran/34770] New: Incorrect array indexing through pointer when array does not start at 1 michalak at ucar dot edu
2008-01-13 16:32 ` [Bug fortran/34770] " burnus at gcc dot gnu dot org
2008-01-13 16:55 ` john at michalakes dot us
2008-03-01 12:21 ` fxcoudert at gcc dot gnu dot org
2008-03-01 12:22 ` fxcoudert 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).