https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95034
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Actually in this case we are probably fine even if b can trap, the reason is that if a evaluated to true, then b in (a && b) is evaluated, and if a evaluates to false, then b in (a || b) is evaluated. So it is all about a and b being the same expressions with no side-effects (which ensures that it isn't just e.g. calling the same function with the same arguments twice).