From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23480 invoked by alias); 3 Feb 2003 12:34:22 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23445 invoked from network); 3 Feb 2003 12:34:21 -0000 Received: from unknown (HELO pat.uio.no) (129.240.130.16) by 172.16.49.205 with SMTP; 3 Feb 2003 12:34:21 -0000 Received: from trebisacce.ifi.uio.no ([129.240.69.179]) by pat.uio.no with esmtp (Exim 2.12 #7) id 18ffnn-00034Z-00; Mon, 3 Feb 2003 13:34:19 +0100 Received: (from mariube@localhost) by trebisacce.ifi.uio.no ; Mon, 3 Feb 2003 13:34:19 +0100 To: bangerth@dealii.org Cc: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: c/9540: C99 initializers generate lots of code In-Reply-To: <20030202221557.18238.qmail@sources.redhat.com> (bangerth@dealii.org's message of "2 Feb 2003 22:15:57 -0000") References: <20030202221557.18238.qmail@sources.redhat.com> From: Marius Bernklev Date: Mon, 03 Feb 2003 12:34:00 -0000 Message-ID: <3cf8ywxpmpg.fsf@trebisacce.ifi.uio.no> User-Agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2 (i686-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-02/txt/msg00094.txt.bz2 List-Id: bangerth@dealii.org writes: > Synopsis: C99 initializers generate lots of code > > State-Changed-From-To: open->feedback > State-Changed-By: bangerth > State-Changed-When: Sun Feb 2 22:15:57 2003 > State-Changed-Why: > Can you send a self-contained code example that shows this? > > Thanks > Wolfgang > > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9540 > Certainly. :) Here goes: // Start of vector.c #include // well, I need size_t // imaginary garbage collector allocator extern void *gc_malloc(size_t); struct string { size_t size; size_t length; char *restrict string; int hash; }; struct string *new_vector1( const size_t length ) { struct string *const restrict result = gc_malloc( sizeof *result ); *result = (struct string) { .size = sizeof *result, .length = length, .string = gc_malloc( length ), .hash = -1 }; return result; } struct string *new_vector2( const size_t length ) { struct string *const restrict result = gc_malloc( sizeof *result ); result->size = sizeof *result; result->length = length; result->string = gc_malloc( length ); result->hash = -1; return result; } --------------------------- with gcc 3.2.1 on x86, with the command line gcc -std=c99 -S vector.c, the code generated for new_vector1 is somewhat larger than for new_vector2. Marius -- Life sucks. Death swallows.