From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0EFFA3870854; Wed, 2 Sep 2020 10:19:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0EFFA3870854 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1599041970; bh=LTJaTRoBglzQU3q3dpLg02E2KI1lkZ7lmdcpZVrQtFs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rkQRMyOb/vo2JhFChMIhN6aJk7/pnYXFg9os+wwVBTWMDDZTKkDVP3vBxFSOa0a2M GPf42FhB45Uxs7yiiGhwqyou5njzY7j4hTxaUiBj44je/JWinv7cKXH3j9hmh1shVg Wdadg6JKPS2O/l7gMxv3qQHp16BB+z9gl0nVeJ3k= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/96859] Wrong answer with intrinsic merge_bits Date: Wed, 02 Sep 2020 10:19:29 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 10:19:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96859 --- Comment #11 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:b567d3bd302933adb253aba9069fd8120c485441 commit r11-2978-gb567d3bd302933adb253aba9069fd8120c485441 Author: Jakub Jelinek Date: Wed Sep 2 12:18:46 2020 +0200 fortran: Fix o'...' boz to integer/real conversions [PR96859] The standard says that excess digits from boz are truncated. For hexadecimal or binary, the routines copy just the number of digits that will be needed, but for octal we copy number of digits that contain one extra bit (for 8-bit, 32-bit or 128-bit, i.e. kind 1, 4 and= 16) or two extra bits (for 16-bit or 64-bit, i.e. kind 2 and 8). The clearing of the first bit is done correctly by changing the first d= igit if it is 4-7 to one smaller by 4 (i.e. modulo 4). The clearing of the first two bits is done by changing 4 or 6 to 0 and 5 or 7 to 1, which is incorrect, because we really want to change t= he first digit to 0 if it was even, or to 1 if it was odd, so digits 2 and 3 are mishandled by keeping them as is, rather than changing 2 to= 0 and 3 to 1. 2020-09-02 Jakub Jelinek PR fortran/96859 * check.c (gfc_boz2real, gfc_boz2int): When clearing first two bits, change also '2' to '0' and '3' to '1' rather than just handling= '4' through '7'. * gfortran.dg/pr96859.f90: New test.=