On Tue, Sep 04, 2007 at 08:37:15PM -0700, Steve Kargl wrote: > On Tue, Sep 04, 2007 at 07:48:08PM -0700, Steve Kargl wrote: > > > My fortran-fu is however not at level to figure out what precisely is > > > going wrong in those two testcases. > > > > I'll try to reduce the do_3.F90 code to a minimum testcase. Unfortunately, > > my middle/back-end knowledge is probably much worse than your Fortran-fu. > > > > Honza, > > I've reduce do_3.F90 to the following code: > > program test > integer :: count
You can delete the above declaration. > integer(kind=1) :: i1 > integer(kind=1), parameter :: h = huge(h) > > count = 0 > do i1 = -huge(i1)-1_1, huge(i1), 1_1 > count = count + 1 > end do You can also delete the above 4 lines. > if (test_i1(-h-1_1, h, 1_1, h+1_1) /= int(h) * 2 + 2) call abort > > contains > > function test_i1 (from, too, step, final) result(res) > integer(kind=1), intent(in) :: from, too, step, final > integer(kind=1) :: i > integer :: res > res = 0 > do i = from, too, step > res = res + 1 > end do > > if (i /= final) call abort > > end function test_i1 > end program test > > A couple comments: > > 1) AFAIK, gfortran will only inline CONTAIN'd function (see the contains > statement above). > There are essentially static functions private to the test program. > > 2) If I comment out either IF statement, then the test will not abort. In > particular, > in the function test_i1, i == final to the 'call abort' is never executed, > but > apparently inlining doesn't like the IF statement. > > 3) integer(kind=1) is equivalent to int8_t. I'll see if I can translate the > Fortran > into a failing C program. > > -- > Steve -- Steve