From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7C5D3858282; Mon, 8 Jan 2024 14:40:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7C5D3858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704724812; bh=Y4Y+gVKrEgbs19rc5N6e/lyPmQir/fXNDlY9UVKbGGg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jbE6jL3rBlFgUzM5jKjfyn7J8uAludHfO2yPUV0noUe/Sj3yn6IKZI/ylp2sDywWQ 7D/jfa+yuZNdd87scdJpGi7Mavyu4PRXc0+q/I4jDcRAtuAyV8coR88SVUputjgG8R GVtN6hKUEWgwURrx7jxVuHOEXAaJ9bTV2hAXsDwQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/113204] lto1: error: qsort comparator non-negative on sorted output: 64 Date: Mon, 08 Jan 2024 14:40:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-valid-code, lto X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113204 --- Comment #4 from Richard Biener --- it's really odd, I don't see how it could fail. The only suspicious bit is int file_order1 =3D n1->lto_file_data ? n1->lto_file_data->order : -1; int file_order2 =3D n2->lto_file_data ? n2->lto_file_data->order : -1; /* Order files same way as they appeared in the command line to reduce seeking while copying sections. */ if (file_order1 !=3D file_order2) return file_order1 - file_order2; the non-presence of n{1,2}->lto_file_data represented as -1 makes whether non-presence is first dependent on the value of the order of the other. Maybe explicitly spelling that out would be better. if (file_order1 !=3D file_order2) { if (file_order1 =3D=3D -1) return -1; if (file_order2 =3D=3D -1) return 1; return file_order1 - file_order2; } or so.=