Very true, and we had a recent demonstration of this in a thread here. The compiler’s built-in intrinsic function index had a bug, but the Gfortran RTL intrinsic index worked correctly. Whether the bug was visible or not depended on the optimization level specified to the compiler. At low optimization levels, the compiler may choose the RTL routine, but at a higher optimization level it may do the evaluation of a constant expression at compile time using the built-in library routine.
Related topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Why a simple code, Intel Fortran -O3 -O2 gives wrong results? | 17 | 1890 | September 23, 2021 | |
Intel vs gfortran performance | 11 | 2378 | November 18, 2022 | |
Gfortran bug or am I missing something? | 12 | 1144 | April 3, 2023 | |
1/inf =? ifort says NaN | 7 | 1006 | December 9, 2022 | |
An interesting difference between compilers | 8 | 1205 | January 12, 2024 |