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: "anlauf at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Oct 2006 13:58:27 -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 #3 from anlauf at gmx dot de 2006-10-11 13:58 -------
(In reply to comment #2)
> I'll note that the Portland, Intel and g95 compilers do not see this issue
> either.
Well, I get a bounds violation with current versions of g95 (0.91)
on both Linux and Cygwin:
% g95 -g -fbounds-check -ftrace=full gfcbug39_bounds_check.f90 && ./a.out
Assignments with correct shapes after RESHAPE...
a(:,1) = 1.
b(:,1) = 1. 2.
...and with wrong shape (should fail with bounds checking on)
At line 17 of file gfcbug39_bounds_check.f90
Traceback: not available, compile with -ftrace=frame or -ftrace=full
Fortran runtime error: Array element out of bounds: 2 in (1:1), dim=2
With xlf 9.1 on AIX:
% xlf95 -qsuffix=f=f90 -C -g gfcbug39_bounds_check.f90
% dbx a.out
Type 'help' for help.
reading symbolic information ...
(dbx) run
Assignments with correct shapes after RESHAPE...
a(:,1) = 1.000000000
b(:,1) = 1.000000000 2.000000000
...and with wrong shape (should fail with bounds checking on)
Trace/BPT trap in gfc_bounds_check at line 17
17 a(:,:) = reshape (v(:), (/ 2, 1 /) )
(dbx)
With Intel I had a discussion about this, as ifc7 reports
a shape violation, and ifort8 and ifort9 do not. Intel
does not consider this a regression, and think that
reimplementing the old behavior in 8.x and 9.x would be
an "enhancement".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28849