Hello world, this patch fixes Fortran's handling of common subexpression elimination across ieee_set_rouding_mode calls. It does so using a rather big hammer, by issuing a memory barrier to force reload from memory (and thus a recomputation). This is a rather big hammer, so if there are more elegant ways to fix it, I am very much open to suggestions. If PR 34678 is fixed, then this solution can also be applied here. OK for trunk? How do you feel about a backport? Best regards Thomas Add memory barrier for calls to ieee_set_rounding_mode. gcc/fortran/ChangeLog: PR fortran/108329 * trans-expr.cc (trans_memory_barrier): New functions. (gfc_conv_procedure_call): Insert memory barrier for ieee_set_rounding_mode. gcc/testsuite/ChangeLog: PR fortran/108329 * gfortran.dg/rounding_4.f90: New test.