https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110359
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Iain Buclaw <ibuc...@gcc.gnu.org>: https://gcc.gnu.org/g:ab134ecb05c6cf1d7a0aee58e7649a93a87c9874 commit r10-11475-gab134ecb05c6cf1d7a0aee58e7649a93a87c9874 Author: Iain Buclaw <ibuc...@gdcproject.org> Date: Mon Jun 26 03:24:27 2023 +0200 d: Suboptimal codegen for __builtin_expect(cond, false) Since PR96435, both boolean objects and expressions have been evaluated in the following way. (*(ubyte*)&obj_or_expr) & 1 It has been noted that sometimes this can cause the back-end to optimize in non-obvious ways - in particular with __builtin_expect. This @safe feature is now restricted to just when reading the value of a bool field that comes from a union. PR d/110359 gcc/d/ChangeLog: * d-convert.cc (convert_for_rvalue): Only apply the @safe boolean conversion to boolean fields of a union. (convert_for_condition): Call convert_for_rvalue in the default case. gcc/testsuite/ChangeLog: * gdc.dg/pr110359.d: New test. (cherry picked from commit ab98db1e8c1b997414539f41b7fb814019497d8d)