This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,committed] fortran/28439 -- Fix arithmetic if
On Sun, Jul 23, 2006 at 12:09:51AM +0200, FX Coudert wrote:
> >2006-07-22 Steven Bosscher <steven@gcc.gnu.org>
> >
> > PR fortran/28439
> > * trans-stmt.c (gfc_trans_arithmetic_if): Evaluate the condition
> > once.
>
> What about a testcase?
>
I've committed a testcase as requested by FX.
2006-07-24 Steven G. Kargl <kargls@comcast.net>
PR fortran/28439
* gfortran.dg/arithmetic_if.f90: New test.
! { dg-do run }
! { dg-options "-w" }
! Test program for PR 28439
integer function myfunc(i)
integer i
integer, save :: value = 2
value = value - 1 + 0 * i
myfunc = value
end function myfunc
program pr28439
integer myfunc
if (myfunc(0)) 10, 20, 30 ! Should go to 10
10 call abort
20 call abort
30 if (myfunc(0)) 40, 50, 60 ! Should go to 20
40 call abort
60 call abort
50 if (myfunc(0)) 70, 80, 90 ! Should go to 30
80 call abort
90 call abort
70 continue
end program pr28439
--
Steve