public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30802]  New: out of bounds error in allocatable array not picked up with -fbounds-check
@ 2007-02-15  0:28 glv at maths dot otago dot ac dot nz
  2007-02-15  0:53 ` [Bug fortran/30802] " fxcoudert at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: glv at maths dot otago dot ac dot nz @ 2007-02-15  0:28 UTC (permalink / raw)
  To: gcc-bugs

Hi All,

For the following code:
program test
real, allocatable :: pos(:,:)
allocate(pos(2,2))
pos = 0.0
print *,pos(5,:)
deallocate(pos)
end program test

when compiled with:
gfortran -fbounds-check test.f95 

the out of bounds array reference in the print command should be picked up, but
isn't.  

Also fails in the same way using g95.

Replacing pos(5,:) with pos(5,1) is picked up.

Thanks, Gareth


-- 
           Summary: out of bounds error in allocatable array not picked up
                    with -fbounds-check
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: glv at maths dot otago dot ac dot nz
 GCC build triplet: x86_64-redhat-linux
  GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux


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


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

* [Bug fortran/30802] out of bounds error in allocatable array not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
@ 2007-02-15  0:53 ` fxcoudert at gcc dot gnu dot org
  2007-03-07  7:23 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-02-15  0:53 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
  GCC build triplet|x86_64-redhat-linux         |
   GCC host triplet|x86_64-redhat-linux         |
 GCC target triplet|x86_64-redhat-linux         |
           Keywords|                            |diagnostic
      Known to fail|                            |4.1.2 4.2.0 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-02-15 00:52:59
               date|                            |


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


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

* [Bug fortran/30802] out of bounds error in allocatable array not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
  2007-02-15  0:53 ` [Bug fortran/30802] " fxcoudert at gcc dot gnu dot org
@ 2007-03-07  7:23 ` burnus at gcc dot gnu dot org
  2007-05-09  7:09 ` fxcoudert at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-07  7:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-03-07 07:23 -------
*** Bug 31059 has been marked as a duplicate of this bug. ***


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vivekrao4 at yahoo dot com


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


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

* [Bug fortran/30802] out of bounds error in allocatable array not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
  2007-02-15  0:53 ` [Bug fortran/30802] " fxcoudert at gcc dot gnu dot org
  2007-03-07  7:23 ` burnus at gcc dot gnu dot org
@ 2007-05-09  7:09 ` fxcoudert at gcc dot gnu dot org
  2007-08-06 21:13 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-05-09  7:09 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-02-15 00:52:59         |2007-05-09 08:09:27
               date|                            |


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


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

* [Bug fortran/30802] out of bounds error in allocatable array not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
                   ` (2 preceding siblings ...)
  2007-05-09  7:09 ` fxcoudert at gcc dot gnu dot org
@ 2007-08-06 21:13 ` fxcoudert at gcc dot gnu dot org
  2007-12-08 18:07 ` [Bug fortran/30802] out of bounds error array I/O " fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-06 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2007-08-06 21:13 -------
It's not about being allocatable, it's the I/O operation that doesn't perform
the necessary check:

$ cat a.f90
  real :: x(2,2)
  x = 0.
  print *, x(5,:)
  x(5,:) = 1.
end
$ gfortran -fbounds-check a.f90 && ./a.out
   0.000000      5.8787666E-39
At line 4 of file a.f90
Fortran runtime error: Array reference out of bounds for array 'x', upper bound
of dimension 1  exceeded


-- 


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


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

* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
                   ` (3 preceding siblings ...)
  2007-08-06 21:13 ` fxcoudert at gcc dot gnu dot org
@ 2007-12-08 18:07 ` fxcoudert at gcc dot gnu dot org
  2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
  2010-04-18 15:31 ` jvdelisle at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-12-08 18:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|fxcoudert at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
                   ` (4 preceding siblings ...)
  2007-12-08 18:07 ` [Bug fortran/30802] out of bounds error array I/O " fxcoudert at gcc dot gnu dot org
@ 2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
  2010-04-18 15:31 ` jvdelisle at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-17 22:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2007-12-17 22:23 -------
I think the problem is that we don't insert bounds checking
in gfc_conv_expr_descriptor.

Another test case:

$ cat index.f90 
module bar
contains
  subroutine foo(a)
  real, dimension(:) :: a
  a = 3.
  end subroutine foo
end module bar
program main
  use bar
  real, dimension(2,2) :: a
  n = 3
  call foo(a(n,:))
end program main
$ gfortran index.f90 
$ gfortran -fbounds-check index.f90 
$ ./a.out


-- 


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


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

* [Bug fortran/30802] out of bounds error array I/O not picked up with -fbounds-check
  2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
                   ` (5 preceding siblings ...)
  2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
@ 2010-04-18 15:31 ` jvdelisle at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2010-04-18 15:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2010-04-18 15:31 -------
Re-confirmed.

We have no bounds checking code in fortran/io.c nor in the I/O library.


-- 


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


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

end of thread, other threads:[~2010-04-18 15:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-15  0:28 [Bug fortran/30802] New: out of bounds error in allocatable array not picked up with -fbounds-check glv at maths dot otago dot ac dot nz
2007-02-15  0:53 ` [Bug fortran/30802] " fxcoudert at gcc dot gnu dot org
2007-03-07  7:23 ` burnus at gcc dot gnu dot org
2007-05-09  7:09 ` fxcoudert at gcc dot gnu dot org
2007-08-06 21:13 ` fxcoudert at gcc dot gnu dot org
2007-12-08 18:07 ` [Bug fortran/30802] out of bounds error array I/O " fxcoudert at gcc dot gnu dot org
2007-12-17 22:23 ` tkoenig at gcc dot gnu dot org
2010-04-18 15:31 ` jvdelisle 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).