This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45425] Bounds check applied before MASK of WHERE construct
- 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: 27 Aug 2010 11:58:25 -0000
- Subject: [Bug fortran/45425] Bounds check applied before MASK of WHERE construct
- References: <bug-45425-19615@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from burnus at gcc dot gnu dot org 2010-08-27 11:58 -------
Confirm, the bounds checks are misplaces. Simplified test case:
implicit none
integer :: A(1), i,b(1)
logical :: mask(1)
mask = .false.
b = 5
do i = 2, 2
where (mask)
A = b(i)
end where
end do
end
If one looks at the dump of the internal representation (-fdump-tree-original)
one sees that WHERE itself is properly handled - only the bounds check is
outside of the WHERE loop and thus outside of the MASK:
if (__builtin_expect (i <= 0, 0))
_gfortran_runtime_error_at (...);
[...]
S.1 = 1;
while (1)
{
if (S.1 > 1) goto L.4;
if (mask[S.1 + -1])
{
a[S.1 + -1] = b[i + -1];
}
S.1 = S.1 + 1;
}
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |27766
nThis| |
Keywords| |wrong-code
Known to fail| |4.1.2 4.6.0
Summary|where mask not applied |Bounds check applied before
|before where clause |MASK of WHERE construct
|evaluated |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45425