https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88579
--- Comment #3 from Harald Anlauf <anlauf at gmx dot de> --- Suggested testcase for the patch in comment #1, derived from power_7.f90: ! { dg-do run } ! { dg-additional-options "-fdump-tree-original" } ! Test optimizations for bases that are powers of 2. program p integer :: i integer(8) :: v v = 1 do i=1,7 v = v * 256_8 if (v /= 256_8 ** i) stop 1 end do v = 1 do i=1,3 v = v * 65536_8 if (v /= 65536_8 ** i) stop 2 end do end program p ! { dg-final { scan-tree-dump-not "_gfortran_pow" "original" } } Don't know how to handle optimizations for (-2**m)**n, maybe someone with better knowledge of the frontend can drop a hint.