public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: optimization/9540: C99 initializers generate lots of code Date: Tue, 13 May 2003 13:26:00 -0000 [thread overview] Message-ID: <20030513132600.26936.qmail@sources.redhat.com> (raw) The following reply was made to PR optimization/9540; it has been noted by GNATS. From: "Christian Ehrhardt" <ehrhardt@mathematik.uni-ulm.de> To: gcc-prs@gcc.gnu.org, mariube+gcc+@ifi.uio.no, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: optimization/9540: C99 initializers generate lots of code Date: Tue, 13 May 2003 15:17:39 +0200 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9540 The code size of the two functions differs because you do two fundamentally different things: * new_vector1 creates a compound literal (this is a separate object not just an initializer!) of type string. The contents of this object are then assigned to *result. * new_vector2 initializes *result directly without the construction of an intermediate compound literal. The additional instructions that you see are the result of the copying which is in general necessary because we can't know if gc_malloc might rely on the memory in *result or might modify previously initialized elements of the compound literal. The latter might be impossible due to aliasing rules but I'm not entirly sure about this. The former is definitely possible, e.g. if the first call to gc_malloc also stored the return value in some static or global variable. Given the fact that gcc does optimize the mem to mem copy away if the compound literal is declared const and gc_malloc is called outside of the initializer I guess that there aren't enough aliasing restrictions to allow the optimization otherwise. regards Christian -- THAT'S ALL FOLKS!
next reply other threads:[~2003-05-13 13:26 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-05-13 13:26 Christian Ehrhardt [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-02-03 21:02 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030513132600.26936.qmail@sources.redhat.com \ --to=ehrhardt@mathematik.uni-ulm.de \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).