This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/28849] Missed array shape violation with RESHAPE despite -fbounds-check
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Nov 2006 19:44:33 -0000
- Subject: [Bug fortran/28849] Missed array shape violation with RESHAPE despite -fbounds-check
- References: <bug-28849-6318@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from burnus at gcc dot gnu dot org 2006-11-08 19:44 -------
See also PR 29572 (matmul(a,b) and matmul(a,transpose(b))).
sunf95 and NAG f95 catch this PR and also PR29572 and also pack().
g95 catches this PR and matmul(a,b), but not matmul(a,transpose(b))).
ifort 9.1 (and 10.0) don't implement these kinds of checks.
For pack, see:
http://gcc.gnu.org/ml/fortran/2006-11/msg00243.html
I think there are two possible solutions:
Specific checks for known functions (reshape, matmul etc.), which is seemingly
what g95 does.
Or a solution for general functions, which seems to be what NAG f95/sunf95 do.
For the latter, a test case is (imagine also pointer, allocatable, in different
modules etc.):
program check
implicit none
real, dimension(2) :: r
r = foo(5)
contains
function foo(n)
integer :: n
real, dimension(n) :: foo
foo = 42.0
end function foo
end program check
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28849