https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96859
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Untested fix: --- gcc/fortran/check.c.jj 2020-08-24 10:00:01.424256990 +0200 +++ gcc/fortran/check.c 2020-09-01 15:06:45.428938642 +0200 @@ -429,9 +429,9 @@ gfc_boz2int (gfc_expr *x, int kind) /* Clear first two bits. */ else { - if (buf[0] == '4' || buf[0] == '6') + if (buf[0] == '2' || buf[0] == '4' || buf[0] == '6') buf[0] = '0'; - else if (buf[0] == '5' || buf[0] == '7') + else if (buf[0] == '3' || buf[0] == '5' || buf[0] == '7') buf[0] = '1'; } }