https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107209
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to ktkachov from comment #5) > aarch64_could_trap_p returns true for it as it can raise an FP exception. > Should that affect the nothrow attribute though? Shouldn't that be for C++ > exceptions only? nothrow isn't just C++ attribute, it is also for C, which uses EH e.g. for pthread_cancel or the non-call exceptions if -fexceptions. Here -fnon-call-exceptions is on and the builtin can trap, so it is right that the builtin isn't marked nothrow, but then you need to either punt on folding that on GIMPLE if flag_non_call_exceptions and there is an EH edge for it, or ensure somehow the EH stuff is preserved during the folding.