This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/34980] [4.3 Regression] Segfault in shape given a scalar
- 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: 28 Jan 2008 17:39:36 -0000
- Subject: [Bug libfortran/34980] [4.3 Regression] Segfault in shape given a scalar
- References: <bug-34980-10743@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from burnus at gcc dot gnu dot org 2008-01-28 17:39 -------
The commit fixed the SHAPE(scalar) problem in the front end. For the library to
do:
a) The following should print "1 0" but it prints "1 -8":
integer :: i,j, a(10,10),res(2)
j = 1
i = 10
res = shape(a(1:1,i:j:1))
print *, res
res = shape(a(1:1,j:i:-1))
print *, res
end
b) The following should be diagnosed with -fbounds-check.
NAG -C=all prints:
Rank 1 of array operand has extent 2 instead of 0
integer :: i,j, a(10,10),res(2)
j = 1
i = 10
res = [42, 24 ]
res(2:j) = shape(a(1:1,i:j))
print *, res
end
I do not know whether one should check this also without -fbounds-check. I
think it is not needed; however, the other compilers seem to have such a check
as they print "42 24" (i.e. "res" is not modified) whereas gfortran prints "42
1". As it is invalid, both choices are OK.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34980