[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-fortran
Subject: Re: Possible bug found handling of elemental overloaded array operations
From: Tobias Burnus <burnus () net-b ! de>
Date: 2010-04-21 21:30:49
Message-ID: 4BCF6E89.6040503 () net-b ! de
[Download RAW message or body]
Hi,
Kyle Horne wrote:
> This is my first attempt at filing a bug report for gfortran, so this seemed like a \
> good place to start.
I think you have found a compiler bug. For:
b(:) = b(:)/b(1)
one needs first to evaluate the right hand side of the equation and then
assign to the left-hand side, i.e. something like that:
do i = 1, 3
tmp(i) = b(i)/b(1)
end do
do i = 1,3
b(i) = tmp(i)
end do
However, currently gfortran does effectively:
do i = 1, 3
b(i) = b(i)/b(1)
end do
which changes the "b(1)" and thus gives a wrong result für b(2) and b(3).
I have now filled a bug report at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43843
Thanks for the report!
Tobias
PS: A really smart compiler would generate the following code:
tmp = b(1)
do i = 1, 3
b(i) = b(i)/tmp
end do
as then only temporary scalar variable and not a temporary array is
needed. But such dependency analysis and is rather difficult to
implement in the compiler.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic