From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3B5D83858412; Tue, 3 Oct 2023 19:10:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B5D83858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696360214; bh=srWCA3ZSVwpyUFVMHdqJ8ZjreLA8KDoUdb5j22URvJg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gY3j7lauRzO2NZcJvYVTtmUhwNJtM8slz5rGmYC2iBJFXBYBNBhgqb7MraFg8l4H7 t9iqhDryXrQKBfMoDWFTYm7PwyhPb9Y7ywOpgi1MhPdRKPhYmUfIhmqI9tVQ8Z/vFx lrPMSPIGvmaKIQ1fFhJWsCOuPGc/StjYnWbok3yc= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/111685] Segfault while sorting on array element address Date: Tue, 03 Oct 2023 19:10:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: bug_status resolution 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=3D111685 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski --- And it is definitely defined incorrectly. Adding a printf in the cmp: __builtin_printf("%p:%p\n", &a, &b); Gives: 0x12072b0:0x12072b0 0x12072b4:0x12072b0 0x7ffe9afcec9c:0x12072b0 0x12072b8:0x12072b0 0x7ffe9afcec9c:0x12072b4 Which means libstdc++ is calling the cmp on a temporary and you not getting= the correct thing.=