https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95018
--- Comment #16 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Hi, I was unable to find a performance problem, so I take back my presumption of the original problem. I have checked two versions of the preprocessed source, with +#pragma GCC unroll 1 while (count[n] == extent[n]) { as the difference. What I found was that with the pragma and -O2 - stack size decreased from 752 bytes to 432 bytes, from the stdu 1,-752(1) instruction - object code size decreased from 7042 to 1936 bytes, determined by looking at the addresses of objdump --disassemble (I also found that #pragma GCC unroll 2 was ignored, but that's for another PR). Considering we have this idiom around 400 times in libgfortran, I would estimate an increase of the size of libgfortan of around two Megabytes. So, what to do? I don't know if the gcc optimization routines can even consider this particular loop to be one that is not often used, although it is an inner loop. As far as libgfortran is concerned, we could simply use the pragma on our sources, but maybe other people have the same issue.