This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34740] -fbounds-check with TRANSFER misses out of bounds in array assignment
- From: "Joost.VandeVondele at mat dot ethz.ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 27 Nov 2013 20:27:30 +0000
- Subject: [Bug fortran/34740] -fbounds-check with TRANSFER misses out of bounds in array assignment
- Auto-submitted: auto-generated
- References: <bug-34740-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34740
Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2009-03-29 08:22:06 |2013-11-27
CC| |Joost.VandeVondele at mat dot ethz
| |.ch
--- Comment #1 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> ---
right... tripped over this in CP2K. Is found by g95.
I notice that the code:
SUBROUTINE S1()
INTEGER, ALLOCATABLE, DIMENSION(:) :: a
CHARACTER, ALLOCATABLE, DIMENSION(:) :: b
ALLOCATE(a(20),b(20))
write(6,*) SIZE(a),SIZE(b)
a=TRANSFER(b,a)
write(6,*) SIZE(a),SIZE(b)
END SUBROUTINE
CALL S1()
END
already does the right reallocation of a, so I'd guess some of the base work
has been done to produce a runtime error with -fcheck=bounds on
SUBROUTINE S1()
INTEGER, POINTER, DIMENSION(:) :: a
CHARACTER, POINTER, DIMENSION(:) :: b
ALLOCATE(a(20),b(20))
write(6,*) SIZE(a),SIZE(b)
a=TRANSFER(b,a)
write(6,*) SIZE(a),SIZE(b)
END SUBROUTINE
CALL S1()
END