public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31059]  New: Detect nonconforming assignment of allocatable arrays
@ 2007-03-06 17:17 vivekrao4 at yahoo dot com
  2007-03-07  7:23 ` [Bug fortran/31059] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-03-06 17:17 UTC (permalink / raw)
  To: gcc-bugs

Gfortran does not report an error if an allocatable array is set to an array of
larger size, for example in the code below.

program xalloc_words
! shows error with nonconformant assignment of an allocatable array
! not caught by most compilers
character (len=1), allocatable :: w(:)
integer, allocatable :: ivec(:)
integer :: jvec(2)
allocate (w(2),ivec(2))
w = ["1","2","3"]
write (*,*) "size(w)=",size(w),"w =",w
ivec = [1,2,3]
write (*,*) "size(ivec)=",size(w),"ivec =",ivec
! error in line below IS caught if not commented
! jvec = [1,2,3]
end program xalloc_words

U:\vrao\fortran>gfortran -v
Using built-in specs.
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/coudert/local --disable-nls
--with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror
--enable-bootstrap --enable-threads --host=i386-pc-mingw32 --disable-shared
--enable-libgomp
Thread model: win32
gcc version 4.3.0 20061021 (experimental)

U:\vrao\fortran>gfortran -W -Wall -pedantic-errors  -std=f2003  -fbounds-check
-Werror xalloc_words.f90
 In file xalloc_words.f90:6

integer :: jvec(2)
                 1
Warning: Unused variable jvec declared at (1)

U:\vrao\fortran>a
 size(w)=           2 w =12
 size(ivec)=           2 ivec =           1           2


Vivek Rao


-- 
           Summary: Detect nonconforming assignment of allocatable arrays
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


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


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

end of thread, other threads:[~2023-09-01 20:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-31059-4@http.gcc.gnu.org/bugzilla/>
2010-12-29 15:23 ` [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays dfranke at gcc dot gnu.org
2010-12-29 15:24 ` dfranke at gcc dot gnu.org
2023-08-30 20:53 ` [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays anlauf at gcc dot gnu.org
2023-08-31 20:15 ` anlauf at gcc dot gnu.org
2023-08-31 20:44 ` anlauf at gcc dot gnu.org
2023-09-01 20:42 ` cvs-commit at gcc dot gnu.org
2007-03-06 17:17 [Bug fortran/31059] New: Detect nonconforming assignment of allocatable arrays vivekrao4 at yahoo dot com
2007-03-07  7:23 ` [Bug fortran/31059] " burnus at gcc dot gnu dot org
2007-08-06 21:18 ` fxcoudert at gcc dot gnu dot org
2007-08-08 16:43 ` fxcoudert at gcc dot gnu dot org
2010-05-20 19:20 ` dfranke at gcc dot gnu dot org
2010-05-23 16:17 ` dfranke 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).