This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Someone has caused regressions in gfortran


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
  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
  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]