From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 78A1E385843A; Tue, 20 Dec 2022 15:28:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78A1E385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1671550125; bh=oeOckvyt+1kZVoEENQgIDJf8smxMjeB3Ujyvs6HOUV4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PcT09cZs0PBWtqqUmAt5CaPZDfKLeYAyrX1KSjgLsG8d4pS9T17jjJoWWbxdSHqgw izLZYhrDmZ7LIZXYvgjS2qYFhdDDgjMq8NktJfNxUEYo0ikSZyCK44Jqv3mWXI3rMo 3dB655lgq6PWSb6kwd2NfAIuKEDVbECt1PYNCC78= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug modula2/108153] Profiled lto bootstrap failure with modula2 Date: Tue, 20 Dec 2022 15:28:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: modula2 X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: gaius at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108153 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dje at gcc dot gnu.org, | |segher at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- What fails is: ./cc1gm2 -msecure-plt -quiet -dumpbase SYSTEM.mod -dumpbase-ext .mod -mtune=3Dpower8 -mcpu=3Dpower8 -version -fpim -fno-scaffold-main -fno-scaffold-dynamic -fno-scaffold-static -fno-m2-plugin -fdump-system-exp= orts -B ./ -B /usr/ppc64le-redhat-linux/bin/ -c -fpim -fno-scaffold-main -fno-scaffold-dynamic -fno-scaffold-static -fno-m2-plugin -fdump-system-exp= orts -I ../../gcc/m2/gm2-libs -I /usr/lib/gcc/ppc64le-redhat-linux/13/m2/m2pim -I /usr/lib/gcc/ppc64le-redhat-linux/13/m2/m2log -I /usr/lib/gcc/ppc64le-redhat-linux/13/m2/m2iso ../../gcc/m2/gm2-libs/SYSTEM.= mod -o /tmp/ccgDXY6u.s and the ICE is because m2assert_AssertLocation inlined into m2statement_BuildAssignmentTree sees a difference on M2Options_OverrideLocation (location) !=3D location location (in $r30) is 0x80000007, while M2Options_OverrideLocation returned= (in $r3) 0xffffffff80000007 instead. M2Options_OverrideLocation ends with 0x00000000102396e0 <+32>: extsw r3,r3 before returning, so it clearly sign extends the 32-bit return value to 64-= bit. And the caller compares whole 64-bits: 0x00000000101c7488 : mr r30,r3 0x00000000101c748c : mr r29,r4 0x00000000101c7490 : mr r31,r5 0x00000000101c7494 : ble 0x101c74a8 0x00000000101c7498 : bl 0x102396c8 0x00000000101c749c : nop =3D> 0x00000000101c74a0 : cmpd r3,r30 So, I bet there must be some mismatch on whether M2Options_OverrideLocation returns a signed or unsigned 32-bit value. I believe the powerpc64le-linux ABI (and probably various other ABIs) retur= ns (and passes?) signed 32-bit values sign-extended from 32-bits to 64-bits, a= nd returns (and passes?) unsigned 32-bit values zero-extended from 32-bits to 64-bits. Say x86_64-linux doesn't do this, the upper 32 bits when passing or returni= ng 32-bit values are undefined.=