From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 783573858D35; Thu, 16 Mar 2023 22:05:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 783573858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679004356; bh=NJiYOVZ+WW5G5n1g3dhyRyBqKvHurnUSO36rG6HMyjU=; h=From:To:Subject:Date:From; b=jghvfhlzjJDta20q94pcFARxA/kp8RvlNxUfcVOzHhZ/gFuMcJSskimfyA0dEY3zR 1w2QKq1RAaEutpZKQ8gFO5Hcvooej27URX2sMhW7O/WV51fFbZWzuqV3qOqSm9jUJa zmYyT1jZEgP0znJWhkT8P28a9th+gWBkY8y/t3Sk= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/109163] New: SARIF (and other JSON) output files are non-deterministic Date: Thu, 16 Mar 2023 22:05:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D109163 Bug ID: 109163 Summary: SARIF (and other JSON) output files are non-deterministic Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- gcc/json.cc's json::object uses a hash_map for tracking the key/value pairs, and object::print iterates through them in arbitrary order, so every time we emit json files they can potentially vary, which makes it much harder to compare them from run to run (see e.g. PR 105959). It would probably be much more user-friendly to use an ordered_hash_map her= e to preserve insertion order and thus have deterministic output. I don't know = if this would have a noticeable performance hit.=