public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35095]  New: DATA with implied-do: Improve bounds checking
@ 2008-02-05 18:00 burnus at gcc dot gnu dot org
  2009-03-29  8:23 ` [Bug fortran/35095] " fxcoudert at gcc dot gnu dot org
  0 siblings, 1 reply; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-02-05 18:00 UTC (permalink / raw)
  To: gcc-bugs

This is a follow-up from PR 32315.

The following accesses valid data, but the array bounds are wrong:

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

Since PR 32315 all invalid memory accesses are detected, but here the problem
is that  string(5,1) is invalid (upper bound is 4) while the memory accessed it
part of string (i.e. "string(1,2)").

Expected:
- gfortran rejects this with -std=f95 or at least warns
- The error message should include the bound [e.g. "(5 > 4)"]
  and the dimension ("in dimension 1").

NAG has:
Error: a.f90, line 3: First subscript (5) is greater than upper bound (4) for
array STRING

gfortran has:
Error: Data element above array upper bound at (1)


-- 
           Summary: DATA with implied-do: Improve bounds checking
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: 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=35095


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

* [Bug fortran/35095] DATA with implied-do: Improve bounds checking
  2008-02-05 18:00 [Bug fortran/35095] New: DATA with implied-do: Improve bounds checking burnus at gcc dot gnu dot org
@ 2009-03-29  8:23 ` fxcoudert at gcc dot gnu dot org
  0 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-03-29  8:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-29 08:23:20
               date|                            |


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


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

* [Bug fortran/35095] DATA with implied-do: Improve bounds checking
       [not found] <bug-35095-4@http.gcc.gnu.org/bugzilla/>
  2023-08-24 21:29 ` anlauf at gcc dot gnu.org
  2023-08-25 16:21 ` cvs-commit at gcc dot gnu.org
@ 2023-08-25 16:25 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-25 16:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35095

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed after 15 years...

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

* [Bug fortran/35095] DATA with implied-do: Improve bounds checking
       [not found] <bug-35095-4@http.gcc.gnu.org/bugzilla/>
  2023-08-24 21:29 ` anlauf at gcc dot gnu.org
@ 2023-08-25 16:21 ` cvs-commit at gcc dot gnu.org
  2023-08-25 16:25 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-25 16:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35095

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:4024ddbe50c2d1cb54c75304c72817d3fc63cdb6

commit r14-3484-g4024ddbe50c2d1cb54c75304c72817d3fc63cdb6
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Aug 24 23:16:25 2023 +0200

    Fortran: improve bounds checking for DATA with implied-do [PR35095]

    gcc/fortran/ChangeLog:

            PR fortran/35095
            * data.cc (get_array_index): Add bounds-checking code and return
error
            status.  Overindexing will be allowed as an extension for
-std=legacy
            and generate an error in standard-conforming mode.
            (gfc_assign_data_value): Use error status from get_array_index for
            graceful error recovery.

    gcc/testsuite/ChangeLog:

            PR fortran/35095
            * gfortran.dg/data_bounds_1.f90: Adjust options to disable
warnings.
            * gfortran.dg/data_bounds_2.f90: New test.

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

* [Bug fortran/35095] DATA with implied-do: Improve bounds checking
       [not found] <bug-35095-4@http.gcc.gnu.org/bugzilla/>
@ 2023-08-24 21:29 ` anlauf at gcc dot gnu.org
  2023-08-25 16:21 ` cvs-commit at gcc dot gnu.org
  2023-08-25 16:25 ` anlauf at gcc dot gnu.org
  2 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-24 21:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35095

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |anlauf at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Patch submitted: https://gcc.gnu.org/pipermail/fortran/2023-August/059711.html

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

end of thread, other threads:[~2023-08-25 16:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-05 18:00 [Bug fortran/35095] New: DATA with implied-do: Improve bounds checking burnus at gcc dot gnu dot org
2009-03-29  8:23 ` [Bug fortran/35095] " fxcoudert at gcc dot gnu dot org
     [not found] <bug-35095-4@http.gcc.gnu.org/bugzilla/>
2023-08-24 21:29 ` anlauf at gcc dot gnu.org
2023-08-25 16:21 ` cvs-commit at gcc dot gnu.org
2023-08-25 16:25 ` anlauf at gcc dot gnu.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).