https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87622
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Some more remarks: In a benchmark, it is best to actually fill the values of all read variables to something defined, for example with a call to random_number. Also, if you generate values which you do not use later, the compilet may decide to remove the calculation altogether. What works well for this somethinh like read (*,*) i,j print *, a(i,j) at the end and then invoke the progtam with echo 1 1 | ./a.out And, of course, please supply the timings.