From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B8E14385DC0E; Mon, 13 Apr 2020 20:34:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8E14385DC0E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1586810052; bh=9JNW3Xe+XoJjAGKnDTKKK3Tw/mB061qseXRG2rfC0eA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LA7cFPLa7vyc70n2bivo00TPdRm65MhcVRf/TE/VKfgqI+GE0Cp8tdXavYnmlW5mK zoWGmfKrcoaTwikALPfd7GcaknWDCRG7wT7gzTf2cQijF60xmPkBQeYaikxYhAQ3bC mQIkZ7wxYGBTQ6fIaJpbeVUNlytPr65GDMMXCM3Q= From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/71218] Add a warning about "new T[integer-literal]" Date: Mon, 13 Apr 2020 20:34:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 7.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW 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: cc 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, 13 Apr 2020 20:34:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D71218 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #4 from Martin Sebor --- Rather than warning for benign but inefficient code I'd find it more friend= ly if GCC optimized it instead (if possible of course). In this case, it shou= ld be possible to rewrite it as suggested (i.e., turn dynamic allocation into automatic). A warning would then be useful if the automatic rewrite wasn't possible for some reason. Conversely, it could also turn stack allocation into dynamic for very large sizes (under some option controlling the cut-off point). This would be especially useful for VLAs.=