From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25422 invoked by alias); 3 Feb 2003 12:36:02 -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 25387 invoked by uid 71); 3 Feb 2003 12:36:01 -0000 Date: Mon, 03 Feb 2003 12:36:00 -0000 Message-ID: <20030203123601.25386.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Marius Bernklev Subject: Re: c/9540: C99 initializers generate lots of code Reply-To: Marius Bernklev X-SW-Source: 2003-02/txt/msg00095.txt.bz2 List-Id: The following reply was made to PR c/9540; it has been noted by GNATS. From: Marius Bernklev 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 Date: Mon, 03 Feb 2003 13:34:19 +0100 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.