Take the following code:
function f () result (mat)
real, dimension(3) :: mat
mat(1) = 1
return
end
program t
real, dimension(3) :: mat
mat = f ()
end
-----
Run it and you will get a bus error/segfault.
I think this is the same as PR 18197.
This works with ICC 8.1.
It was reduced from Fortran Execution Time Benchmarks at Polyhedron:
http://www.polyhedron.com/compare/linux/f90bench.tgz
--
Summary: bus error for return an array
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 18197
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20960