public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32315]  New: DATA with implied-do: Bounds checks missing
@ 2007-06-13  6:25 burnus at gcc dot gnu dot org
  2007-06-13  6:46 ` [Bug fortran/32315] " burnus at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-13  6:25 UTC (permalink / raw)
  To: gcc-bugs

Found at:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/34f509b6b4241c6d/

program chkdata
    character(len=20), dimension(4) :: string
    data ( string(i) ,i=1,5 ) / &
        'A', 'B', 'C', 'D', 'E' /
    write(*,*) string
end program chkdata

gfortran gives no warning/error whereas NAG f95 rejects it with:
  Error line 5: First subscript (5) is greater than upper bound (4)
  for array STRING
and g95 rejects it with:
  Error: Out of bounds array reference at (1)
and sunf95 with:
  ERROR: The upper bound for dimension 1 of the array STRING is out of range.

(ifort does the same as gfortran: It accepts it.)


-- 
           Summary: DATA with implied-do: Bounds checks missing
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
@ 2007-06-13  6:46 ` burnus at gcc dot gnu dot org
  2007-06-13 20:51 ` fxcoudert at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-13  6:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-06-13 06:46 -------
Dump shows:

static char string[4][1:20] = {"A                   ", "B                   ",
"C                   ", "D                   ", "E                   " }


Check should probably be in resolve.c's check_data_variable.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.1.3 4.2.0 4.3.0
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
  2007-06-13  6:46 ` [Bug fortran/32315] " burnus at gcc dot gnu dot org
@ 2007-06-13 20:51 ` fxcoudert at gcc dot gnu dot org
  2007-06-14  6:43 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-06-13 20:51 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |27766
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-13 20:51:44
               date|                            |


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
  2007-06-13  6:46 ` [Bug fortran/32315] " burnus at gcc dot gnu dot org
  2007-06-13 20:51 ` fxcoudert at gcc dot gnu dot org
@ 2007-06-14  6:43 ` burnus at gcc dot gnu dot org
  2008-01-20 11:56 ` [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77] tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-14  6:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-06-14 06:43 -------
Using
    data ( string(i) ,i=-3,1 ) / &
        'A', 'B', 'C', 'D', 'E' /
gives even an ICE.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77]
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-06-14  6:43 ` burnus at gcc dot gnu dot org
@ 2008-01-20 11:56 ` tkoenig at gcc dot gnu dot org
  2008-02-05  9:37 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-20 11:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2008-01-20 10:48 -------
This is a regression vs. g77:

$ cat foo.f 
      program chkdata
      character*20 string(4)
      data ( string(i) ,i=1,5 ) /'A', 'B', 'C', 'D', 'E' /
      write(*,*) string
      end
$ g77 foo.f
foo.f: In program `chkdata':
foo.f:3: 
         data ( string(i) ,i=1,5 ) /'A', 'B', 'C', 'D', 'E' /
                                                        ^
Attempt to specify second initial value for `string' at (^)

$ cat bar.f
      program chkdata
      character*20 string(4)
      data ( string(i) ,i=-3,1 ) /'A', 'B', 'C', 'D', 'E' /
      write(*,*) string
      end
$ g77 bar.f
Array subscript #1 out of range for initialization of `string' in statement at
(1)
Array subscript #1 out of range for initialization of `string' in statement at
(1)
bar.f: In program `chkdata':
bar.f:3: 
         data ( string(i) ,i=-3,1 ) /'A', 'B', 'C', 'D', 'E' /
                                          ^
Attempt to specify second initial value for element of `string' at (^)
Array subscript #1 out of range for initialization of `string' in statement at
(1)
bar.f:3: 
         data ( string(i) ,i=-3,1 ) /'A', 'B', 'C', 'D', 'E' /
                                               ^
Attempt to specify second initial value for element of `string' at (^)
Array subscript #1 out of range for initialization of `string' in statement at
(1)
bar.f:3: 
         data ( string(i) ,i=-3,1 ) /'A', 'B', 'C', 'D', 'E' /
                                                    ^
Attempt to specify second initial value for element of `string' at (^)
bar.f:3: 
         data ( string(i) ,i=-3,1 ) /'A', 'B', 'C', 'D', 'E' /
                                                         ^
Attempt to specify second initial value for element of `string' at (^)
$ 


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org
            Summary|DATA with implied-do: Bounds|DATA with implied-do: Bounds
                   |checks missing              |checks missing [regression
                   |                            |vs. g77]


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77]
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-01-20 11:56 ` [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77] tkoenig at gcc dot gnu dot org
@ 2008-02-05  9:37 ` pault at gcc dot gnu dot org
  2008-02-05 11:18 ` pault at gcc dot gnu dot org
  2008-02-05 13:07 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-02-05  9:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2008-02-05 09:36 -------
I have just posted a patch, so I had better take the PR on!

http://gcc.gnu.org/ml/fortran/2008-02/msg00027.html

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-06-13 20:51:44         |2008-02-05 09:36:48
               date|                            |


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77]
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-02-05  9:37 ` pault at gcc dot gnu dot org
@ 2008-02-05 11:18 ` pault at gcc dot gnu dot org
  2008-02-05 13:07 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-02-05 11:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2008-02-05 11:17 -------
Subject: Bug 32315

Author: pault
Date: Tue Feb  5 11:16:33 2008
New Revision: 132113

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132113
Log:
2008-02-05  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32315
        * data.c (gfc_assign_data_value): Add bounds check for array
        references.

2008-02-05  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/32315
        * gfortran.dg/data_bounds_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/data_bounds_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/data.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77]
  2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-02-05 11:18 ` pault at gcc dot gnu dot org
@ 2008-02-05 13:07 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-02-05 13:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2008-02-05 13:06 -------
Fixed on trunk

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-02-05 13:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-13  6:25 [Bug fortran/32315] New: DATA with implied-do: Bounds checks missing burnus at gcc dot gnu dot org
2007-06-13  6:46 ` [Bug fortran/32315] " burnus at gcc dot gnu dot org
2007-06-13 20:51 ` fxcoudert at gcc dot gnu dot org
2007-06-14  6:43 ` burnus at gcc dot gnu dot org
2008-01-20 11:56 ` [Bug fortran/32315] DATA with implied-do: Bounds checks missing [regression vs. g77] tkoenig at gcc dot gnu dot org
2008-02-05  9:37 ` pault at gcc dot gnu dot org
2008-02-05 11:18 ` pault at gcc dot gnu dot org
2008-02-05 13:07 ` pault 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).