$ cat foo.f90
subroutine foo
  implicit none
  integer :: i,n
  do i=1,10
    n = (-1)**(i+1)
    call bar(n)
  end do
end subroutine foo
$ gfortran -S -O2 -fdump-tree-optimized foo.f90
...

  i = i + 1;
  n.0 = _gfortran_pow_i4_i4 (-1, i);
  n = n.0;
  bar (&n);

We could eliminate the call to _gfortran_pow_i4_i4.


-- 
           Summary: Optimizing integer power
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39280

Reply via email to