This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/28849] Missed array shape violation with RESHAPE despite -fbounds-check



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]