https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96811
--- Comment #4 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Thu, Aug 27, 2020 at 04:57:14PM +0000, burnus at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96811 > > --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> --- > (In reply to kargl from comment #2) > > For real x, gfortran does not generate a call to libgfortran function. > > It does – as mentioned in my email reply but not only for 'int' integers: Not sure what you mean by email reply, ... > > integer(16) :: n > real :: x, y > y = x**n > end > > calls: > y = _gfortran_pow_r4_i16 (D.3904, n); > Ah, yes. It seems integer(8) and integer(16) generate libgfortran calls. Somewhat surprising as x**n will underflow/overflow for rather small values of |n|. Worse case is for real(16) where |n| > |emin| + p will overflow for the smallest subnormal number (ie., |n| = 32768+113). Seems like gfortran could do if (|n| > magic number) if (n < 0) return (underflow to zero):(overflow to inf) return _builtin_powif(x, (integer 4) n)