I am using the Reduced Precision Emulator library to emulate reduced precision in some Fortran code. The library gives a new type that can replace real type variables with reduced-precision variables and overloads basic arithmetic operations so that the variable is truncated after each operation. The library uses elemental subroutines to achieve this.
I want to trigger an error within the library (during the truncation operation) when certain criteria are met but the elemental subroutines are restrictive. I used the code from the answer to this previous question to trigger an error from within an elemental subroutine in the reduced-precision emulator library. However, the error triggered doesn't produce any traceback. I've used the gfortran compiler and tried the -g and -ftraceback in the compilation of the main Fortran code and the library itself but I only get a traceback when the error is produced outside the elemental subroutines.
Does anyone know how I can trigger an error within an elemental subroutine and get a useful traceback?
The code I am editing is https://github.com/aopp-pred/rpe/blob/master/src/rp_emulator.F90, specifically the elemental function adjust_ieee_half.