public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14903] New: tail call optimization does not work with char return type
@ 2004-04-10 2:47 cesarb at nitnet dot com dot br
2004-04-10 3:01 ` [Bug optimization/14903] tail call optimization does not work with char/short " pinskia at gcc dot gnu dot org
2004-05-09 22:30 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: cesarb at nitnet dot com dot br @ 2004-04-10 2:47 UTC (permalink / raw)
To: gcc-bugs
(old bug but couldn't find on bugzilla, see
http://gcc.gnu.org/ml/gcc/2002-09/msg00632.html )
When compiling:
extern unsigned char f(void);
unsigned char g(void) { return f(); }
With:
gcc -W -Wall -Os -fomit-frame-pointer -save-temps -c
The result is:
g:
call f
movzbl %al, %eax
ret
Notice the superfluous zero extension (signed char has a sign extension
instead). Without it, the call would be optimized to a jmp.
This makes it harder to try to use tail-recursive functions as if they were
loops (where the loop goes through 3-4 functions with one or two of them looked
up on a table).
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040401)
--
Summary: tail call optimization does not work with char return
type
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cesarb at nitnet dot com dot br
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14903
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug optimization/14903] tail call optimization does not work with char/short return type
2004-04-10 2:47 [Bug optimization/14903] New: tail call optimization does not work with char return type cesarb at nitnet dot com dot br
@ 2004-04-10 3:01 ` pinskia at gcc dot gnu dot org
2004-05-09 22:30 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-10 3:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-10 02:42 -------
Confirmed, related to 14440, 14472, and 14441 but should depend only on PR 14441 as the problem
is that the char is promoted to int.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Severity|normal |enhancement
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |pessimizes-code
Last reconfirmed|0000-00-00 00:00:00 |2004-04-10 02:42:38
date| |
Summary|tail call optimization does |tail call optimization does
|not work with char return |not work with char/short
|type |return type
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14903
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug optimization/14903] tail call optimization does not work with char/short return type
2004-04-10 2:47 [Bug optimization/14903] New: tail call optimization does not work with char return type cesarb at nitnet dot com dot br
2004-04-10 3:01 ` [Bug optimization/14903] tail call optimization does not work with char/short " pinskia at gcc dot gnu dot org
@ 2004-05-09 22:30 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-09 22:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-09 22:30 -------
This is a dup of bug 14441, the patch which fixes that also fixes this one.
*** This bug has been marked as a duplicate of 14441 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14903
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-09 22:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-10 2:47 [Bug optimization/14903] New: tail call optimization does not work with char return type cesarb at nitnet dot com dot br
2004-04-10 3:01 ` [Bug optimization/14903] tail call optimization does not work with char/short " pinskia at gcc dot gnu dot org
2004-05-09 22:30 ` pinskia at gcc dot gnu dot org
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).