public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/15529] New: Use of regparm inhibits tail call optimization
@ 2004-05-19 14:07 cesarb at nitnet dot com dot br
2004-05-19 15:51 ` [Bug target/15529] " pinskia at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: cesarb at nitnet dot com dot br @ 2004-05-19 14:07 UTC (permalink / raw)
To: gcc-bugs
(I would have put this in the right optimization component if I knew which of
them applies. Worse, bugzilla requires it. Let me take a guess... 50/50
chance... RTL?)
This is bug 14909 plus regparm. The testcase of bug 14909 works as expected.
When compiling:
//void g(void (*f)(void)) { f(); }
#define regparm __attribute__((regparm(3)))
void regparm g(void (regparm *f)()) { f(); }
With:
gcc -W -Wall -O3 -ffast-math -fomit-frame-pointer -fexpensive-optimizations
-save-temps -march=athlon -c
(most switches probably a red herring, didn't reduce the command line)
The result is:
.file "testcase.c"
.text
.align 4
.p2align 4,,15
.globl g
.type g, @function
g:
subl $12, %esp
call *%eax
addl $12, %esp
ret
.size g, .-g
.ident "GCC: (GNU) 3.5.0 20040502 (experimental)"
.section .note.GNU-stack,"",@progbits
It should be:
g:
jmp *%eax
The use of regparm is superfluous in this case, but the bug happens also in the
slightly less reduced testcase:
#define regparm __attribute__((regparm(3)))
void regparm g(void (regparm *f)(unsigned)) { f(0); }
Output:
.file "testcase2.c"
.text
.align 4
.p2align 4,,15
.globl g
.type g, @function
g:
subl $12, %esp
movl %eax, %edx
xorl %eax, %eax
call *%edx
addl $12, %esp
ret
.size g, .-g
.ident "GCC: (GNU) 3.5.0 20040502 (experimental)"
.section .note.GNU-stack,"",@progbits
The same happens when returning other than void (original testcase used
unsigned) -- same as bug 14909 in fact.
Reading specs from /usr/lib/gcc-snapshot/lib/gcc/i486-linux/3.5.0/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,objc,ada,treelang
--prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls
--enable-threads=posix --without-included-gettext --disable-werror
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-java-gc=boehm --enable-java-awt=gtk i486-linux
Thread model: posix
gcc version 3.5.0 20040502 (experimental)
--
Summary: Use of regparm inhibits tail call optimization
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-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=15529
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/15529] Use of regparm inhibits tail call optimization
2004-05-19 14:07 [Bug rtl-optimization/15529] New: Use of regparm inhibits tail call optimization cesarb at nitnet dot com dot br
@ 2004-05-19 15:51 ` pinskia at gcc dot gnu dot org
2004-05-19 15:52 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-19 15:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-18 23:02 -------
Confirmed, it is now a target problem as it is dected on the tree level so the target back-end is making
the middle-end expand it as a normal indirect call.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|rtl-optimization |target
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2004-05-18 23:02:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15529
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/15529] Use of regparm inhibits tail call optimization
2004-05-19 14:07 [Bug rtl-optimization/15529] New: Use of regparm inhibits tail call optimization cesarb at nitnet dot com dot br
2004-05-19 15:51 ` [Bug target/15529] " pinskia at gcc dot gnu dot org
@ 2004-05-19 15:52 ` pinskia at gcc dot gnu dot org
2004-05-20 18:34 ` giovannibajo at libero dot it
2004-05-21 18:12 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-19 15:52 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15529
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/15529] Use of regparm inhibits tail call optimization
2004-05-19 14:07 [Bug rtl-optimization/15529] New: Use of regparm inhibits tail call optimization cesarb at nitnet dot com dot br
2004-05-19 15:51 ` [Bug target/15529] " pinskia at gcc dot gnu dot org
2004-05-19 15:52 ` pinskia at gcc dot gnu dot org
@ 2004-05-20 18:34 ` giovannibajo at libero dot it
2004-05-21 18:12 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2004-05-20 18:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-05-19 17:21 -------
Is this a regression?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15529
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/15529] Use of regparm inhibits tail call optimization
2004-05-19 14:07 [Bug rtl-optimization/15529] New: Use of regparm inhibits tail call optimization cesarb at nitnet dot com dot br
` (2 preceding siblings ...)
2004-05-20 18:34 ` giovannibajo at libero dot it
@ 2004-05-21 18:12 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-21 18:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-20 17:44 -------
there is a fixme in the code:
/* ??? Need to count the actual number of registers to be used,
not the possible number of registers. Fix later. */
return false;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15529
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-05-20 17:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-19 14:07 [Bug rtl-optimization/15529] New: Use of regparm inhibits tail call optimization cesarb at nitnet dot com dot br
2004-05-19 15:51 ` [Bug target/15529] " pinskia at gcc dot gnu dot org
2004-05-19 15:52 ` pinskia at gcc dot gnu dot org
2004-05-20 18:34 ` giovannibajo at libero dot it
2004-05-21 18:12 ` 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).