public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: beszedes@rgai.hu To: gcc-gnats@gcc.gnu.org Subject: middle-end/9967: Some standard C function calls should not be replaced when optimizing for size Date: Wed, 05 Mar 2003 14:26:00 -0000 [thread overview] Message-ID: <20030305142551.31716.qmail@sources.redhat.com> (raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1478 bytes --] >Number: 9967 >Category: middle-end >Synopsis: Some standard C function calls should not be replaced when optimizing for size >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Wed Mar 05 14:26:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Árpád Beszédes >Release: gcc version 3.3 20030224 (prerelease) >Organization: >Environment: BUILD & HOST: Linux 2.4.20 i686 unknown TARGET: arm-unknown-elf >Description: GCC replaces calls with special parameters to some standard C functions to equivalent ones in order to increase performance. E.g. fputs with string parameter -> fwrite. However, some of these calls take more instructions, which is not good if we optimize for size. These replacements should be avoided depending on the optimization switches. (See example below.) >How-To-Repeat: This simple program demonstrates that fprintf is replaced by calling fwrite in the assembly output (arm-elf target with newlib library): #include <stdio.h> void foo () { fprintf(stderr, "Comment"); // fprintf->fwrite } ldr r3, .L2 ldr r3, [r3, #0] ldr r0, .L2+4 ldr r3, [r3, #12] mov r1, #1 mov r2, #7 b fwrite However, calling fprintf would require two instructions less: ldr r3, .L2 ldr r3, [r3, #0] ldr r1, .L2+4 ldr r0, [r3, #12] b fprintf >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-03-05 14:26 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-05 14:26 beszedes [this message] 2003-03-28 10:16 Arpad Beszedes 2003-03-28 10:46 ebotcazou 2003-03-30 8:36 Kaveh R. Ghazi
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=20030305142551.31716.qmail@sources.redhat.com \ --to=beszedes@rgai.hu \ --cc=gcc-gnats@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).