https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108153
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dje at gcc dot gnu.org, | |segher at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- What fails is: ./cc1gm2 -msecure-plt -quiet -dumpbase SYSTEM.mod -dumpbase-ext .mod -mtune=power8 -mcpu=power8 -version -fpim -fno-scaffold-main -fno-scaffold-dynamic -fno-scaffold-static -fno-m2-plugin -fdump-system-exports -B ./ -B /usr/ppc64le-redhat-linux/bin/ -c -fpim -fno-scaffold-main -fno-scaffold-dynamic -fno-scaffold-static -fno-m2-plugin -fdump-system-exports -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) != 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 <m2statement_BuildAssignmentTree(location_t, tree, tree)+40>: mr r30,r3 0x00000000101c748c <m2statement_BuildAssignmentTree(location_t, tree, tree)+44>: mr r29,r4 0x00000000101c7490 <m2statement_BuildAssignmentTree(location_t, tree, tree)+48>: mr r31,r5 0x00000000101c7494 <m2statement_BuildAssignmentTree(location_t, tree, tree)+52>: ble 0x101c74a8 <m2statement_BuildAssignmentTree(location_t, tree, tree)+72> 0x00000000101c7498 <m2statement_BuildAssignmentTree(location_t, tree, tree)+56>: bl 0x102396c8 <M2Options_OverrideLocation(m2linemap_location_t)+8> 0x00000000101c749c <m2statement_BuildAssignmentTree(location_t, tree, tree)+60>: nop => 0x00000000101c74a0 <m2statement_BuildAssignmentTree(location_t, tree, tree)+64>: 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) returns (and passes?) signed 32-bit values sign-extended from 32-bits to 64-bits, and 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 returning 32-bit values are undefined.