public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "henning dot m at insightbb dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/33970] New: Missed optimization using unsigned char loop variable Date: Thu, 01 Nov 2007 13:44:00 -0000 [thread overview] Message-ID: <bug-33970-15294@http.gcc.gnu.org/bugzilla/> (raw) When using an unsigned char in a loop with limited range the variable is promoted to a 16 bit integer if the variable is passed to another function within the loop by value. Tested using -Os on ATMEGA162: #include <avr/io.h> int sub2(uint8_t); int main(void) { static uint8_t x; volatile uint8_t y; while(1) { for(x=0;x<128; x++) { y+=sub2(x); } } return 0; } int sub2(uint8_t xyz) { volatile uint8_t abc; while(xyz < 64) { xyz++; abc+=xyz; } return abc; } -- Summary: Missed optimization using unsigned char loop variable Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: henning dot m at insightbb dot com GCC build triplet: WinAVR 20070525 GCC target triplet: avr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33970
next reply other threads:[~2007-11-01 13:44 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-11-01 13:44 henning dot m at insightbb dot com [this message] 2007-11-01 14:10 ` [Bug c/33970] " rguenth at gcc dot gnu dot org 2007-11-01 17:09 ` [Bug middle-end/33970] " pinskia at gcc dot gnu dot org 2007-11-01 17:28 ` eweddington at cso dot atmel dot com 2007-11-01 17:45 ` eweddington at cso dot atmel dot com 2007-11-01 17:47 ` eweddington at cso dot atmel dot com 2007-11-01 21:26 ` henning dot m at insightbb dot com 2007-11-04 23:28 ` eweddington at cso dot atmel dot com 2007-11-04 23:28 ` eweddington at cso dot atmel dot com 2007-11-05 22:48 ` wvangulik at xs4all dot nl 2007-11-06 12:37 ` henning dot m at insightbb dot com 2007-11-06 19:35 ` wvangulik at xs4all dot nl 2007-11-06 21:01 ` wvangulik at xs4all dot nl 2010-09-13 12:09 ` abnikant dot singh at atmel dot com
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=bug-33970-15294@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).