From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 37BDF3861C56; Mon, 16 Mar 2020 19:10:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37BDF3861C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1584385802; bh=0IY3xCghBhGHUDQ6d3uvfOXEJC7ENB9yR1cGvJo2G7Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SUmdsrt/YREmXo/th1w2rWHNwYfanjYiKwQgN53DHPnUXuU1g6nE2f+8VYtupx72N F7syvytYOY/Fu6XYYrRUi/HTYUBZ9kDBbTN5C1WjmkwdeQE6SWRcaycHR24MHaSIE/ 5y50GaxR8NDPy5isKnMivwRCLJjuMQEd2K65dG5I= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/94169] warn for modifying getenv() result Date: Mon, 16 Mar 2020 19:10:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: msebor 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: blocked 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2020 19:10:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94169 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|88781 | --- Comment #1 from Martin Sebor --- On second thought, rather than extending -Wstringop-overflow it might be be= tter to diagnoses this under "modifying a const object" as requested in 90404. = In addition, rather than diagnosing only built-in functions (and growing the l= ist GCC would have to recognize just to detect bugs), providing an attribute to= let users denote pointers to non-modifiable objects would be a better solution.= It could be an entirely new attribute or it could be done by extending the existing access attribute read_only to apply also to pointers returned from functions and even to data members. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88781 [Bug 88781] [meta-bug] bogus/missing -Wstringop-truncation warnings=