https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118499
--- Comment #26 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- There is a bit more that can be done when the exponent is known at compile time. For example, unsigned(kind=4) :: x y = x**13u could be translated as if (x & 7 == 0) /* Check for divisibility by 8 */ y = 0 /* (8**13 = 2**39 > 2**32) */ else y = /* Calculation as now */; Hmm... what would be the limit for this to be profitable?