Article View: gnu.gcc.help
Article #49711Re: recursion
From: Michael T.Y. McNamara
Date: Thu, 30 Dec 1993 21:59
Date: Thu, 30 Dec 1993 21:59
53 lines
2420 bytes
2420 bytes
| Hello,
| Can anyone explain me strange behaviour on SPARC
| for following function:
|
| void pp( int *i )
| {
| int j;
|
| pp( &j );
| }
|
| when compiled with -O2 (-O4 for cc) by
| gcc uses about 120 bytes on stack for each call,
| cc ... 104 ...
| acc ... 112 ...
|
| when in reality (if I'm not mistaken) all we need is:
|
| Instruction pointer,
| Stack pointer,
| Argument "i"
| Local variable "j"
| -------------------
| = 16 bytes !!
|
| why is WINDOWSIZE in gcc 20, and in cc 16 ?
|
| Thanks, Igor
I don't know for sure, but I'll guess gcc is be default using the
extra 4 bytes on the stack to hold the frame pointer. You can ask gcc
to not do this.
See the info page for gcc:
`-fomit-frame-pointer'
Don't keep the frame pointer in a register for functions that
don't need one. This avoids the instructions to save, set up and
restore frame pointers; it also makes an extra register available
in many functions. *It also makes debugging impossible on some
machines.*
On some machines, such as the Vax, this flag has no effect, because
the standard calling sequence automatically handles the frame
pointer and nothing is saved by pretending it doesn't exist. The
machine-description macro `FRAME_POINTER_REQUIRED' controls
whether a target machine supports this flag. *Note Registers::.
--
,------. Michael McNamara Send mail to info@chronologic.com for INFO
|CHRONO|LOGIC SIMULATION to support@chronologic.com for SUPPORT
`------' See our AD in EE Times! For information, call 1-800-VERILOG
Technical Details
Message-ID:
<MAC.93Dec30135940@rhea.chronologic.com>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!yale.edu!spool.mu.edu!sgiblab!news.kpc.com!kpc!chrnlgc!themis!macReferences:
<2fueqc$nf2@news.uni-paderborn.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,77ed4294c69534c5 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-12-30 17:04:34 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!yale.edu!spool.mu.edu!sgiblab!news.kpc.com!kpc!chrnlgc!themis!mac From: mac@rhea.chronologic.com (Michael T.Y. McNamara) Subject: Re: recursion In-Reply-To: igor@uni-paderborn.de's message of 30 Dec 1993 11:42:04 GMT To: igor@uni-paderborn.de (Igor Durdanovic) Message-ID: <MAC.93Dec30135940@rhea.chronologic.com> Lines: 53 Sender: usenet@chronologic.com Nntp-Posting-Host: rhea Reply-To: mac@chronologic.com Organization: Chronologic Simulation References: <2fueqc$nf2@news.uni-paderborn.de> Date: Thu, 30 Dec 1993 21:59:40 GMT