public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
[not found] <bug-31059-4@http.gcc.gnu.org/bugzilla/>
@ 2010-12-29 15:23 ` dfranke at gcc dot gnu.org
2010-12-29 15:24 ` dfranke at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: dfranke at gcc dot gnu.org @ 2010-12-29 15:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
--- Comment #5 from Daniel Franke <dfranke at gcc dot gnu.org> 2010-12-29 15:22:44 UTC ---
*** Bug 32454 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
[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
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: dfranke at gcc dot gnu.org @ 2010-12-29 15:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
--- Comment #6 from Daniel Franke <dfranke at gcc dot gnu.org> 2010-12-29 15:22:47 UTC ---
*** Bug 34741 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays
[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 ` anlauf at gcc dot gnu.org
2023-08-31 20:15 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-30 20:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #9 from anlauf at gcc dot gnu.org ---
Created attachment 55821
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55821&action=edit
Partial patch (proof of concept)
The attached patch adds bounds-checking for the case that the r.h.s. has
only an array constructor.
Note the the original testcase is bogus, as it does not prevent (re)allocation
on assignment, which became default in F2003.
Adjusted testcase:
program p
integer :: jvec(3) = [1,2,3]
integer, allocatable :: ivec(:)
allocate (ivec(2))
ivec(:) = [4,5,6] ! shall be detected
ivec(:) = jvec ! already detected
end
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays
[not found] <bug-31059-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
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
5 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-31 20:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #55821|0 |1
is obsolete| |
--- Comment #10 from anlauf at gcc dot gnu.org ---
Created attachment 55828
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55828&action=edit
Improved patch
This one also handles arbitrary order of array section and constructor.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays
[not found] <bug-31059-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
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
5 siblings, 0 replies; 11+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-08-31 20:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
--- Comment #11 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-August/059722.html
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] bounds-check does not detect nonconforming assignment arrays
[not found] <bug-31059-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2023-08-31 20:44 ` anlauf at gcc dot gnu.org
@ 2023-09-01 20:42 ` cvs-commit at gcc dot gnu.org
5 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-01 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
--- Comment #12 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:6f06152541d62ae7c8579b7d7bf552be19e15b05
commit r14-3633-g6f06152541d62ae7c8579b7d7bf552be19e15b05
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Aug 31 22:19:58 2023 +0200
Fortran: runtime bounds-checking in presence of array constructors
[PR31059]
gcc/fortran/ChangeLog:
PR fortran/31059
* trans-array.cc (gfc_conv_ss_startstride): For array bounds
checking,
consider also array constructors in expressions, and use their
shape.
gcc/testsuite/ChangeLog:
PR fortran/31059
* gfortran.dg/bounds_check_fail_5.f90: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [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
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
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 ` burnus at gcc dot gnu dot org
2007-08-06 21:18 ` fxcoudert at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 11+ 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 -------
Confirmed, gfortran should print something like:
"Rank 1 of array operand has extent 2 instead of 3"
*** This bug has been marked as a duplicate of 30802 ***
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
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
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-06 21:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fxcoudert at gcc dot gnu dot org 2007-08-06 21:18 -------
I don't think it's a duplicate, and I don't think it has anything to do with
allocatable either:
$ cat b.f90
subroutine foo(n)
integer, allocatable :: ivec(:)
integer :: jvec(n)
allocate (ivec(n))
ivec = [1,2,3]
write (*,*) ivec
jvec = [1,2,3]
write (*,*) jvec
end
program test
call foo (2)
end
$ gfortran -fbounds-check b.f90 && ./a.out
1 2
1 2
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fxcoudert at gcc dot gnu dot
| |org
OtherBugsDependingO| |27766
nThis| |
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
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
4 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-08-08 16:43 UTC (permalink / raw)
To: gcc-bugs
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-08-08 16:43:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
2007-03-06 17:17 [Bug fortran/31059] New: Detect nonconforming assignment of allocatable arrays vivekrao4 at yahoo dot com
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 11+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-20 19:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dfranke at gcc dot gnu dot org 2010-05-20 19:19 -------
*** Bug 39994 has been marked as a duplicate of this bug. ***
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31059
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug fortran/31059] Detect nonconforming assignment of allocatable arrays
2007-03-06 17:17 [Bug fortran/31059] New: Detect nonconforming assignment of allocatable arrays vivekrao4 at yahoo dot com
` (3 preceding siblings ...)
2010-05-20 19:20 ` dfranke at gcc dot gnu dot org
@ 2010-05-23 16:17 ` dfranke at gcc dot gnu dot org
4 siblings, 0 replies; 11+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2010-05-23 16:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dfranke at gcc dot gnu dot org 2010-05-23 16:16 -------
Aren't PR32454 and PR34741 duplicates of this also?
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
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).