From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27517 invoked by alias); 10 Sep 2010 15:47:41 -0000 Received: (qmail 27484 invoked by uid 48); 10 Sep 2010 15:47:30 -0000 Date: Fri, 10 Sep 2010 15:47:00 -0000 Message-ID: <20100910154730.27483.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/45636] Failed to fold simple Fortran string In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-09/txt/msg01374.txt.bz2 ------- Comment #5 from jakub at gcc dot gnu dot org 2010-09-10 15:47 ------- For arbitrary lengths (both of the constant string and of the padding) the memmove (which will be optimized to memcpy as the source is read-only) + memset is the best thing to do, replacing say memmove (x, "900 bytes long string", 900); memset (x + 900, ' ', 100); would be very .rodata size unfriendly. So, the question is, do we want to optimize this for very small sizes of both (what sizes? Should we call can_store_by_pieces to determine that from the FE?) in the FE by transforming that say memmove (x, "ABCDE", 5); memset (x + 5, ' ', 3); into memcpy (x, "ABCDE ", 8); or should we do this generically in the middle-end, where we'd do this transformation for such cases even for other languages? -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45636