public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ihar 'Philips' Filipau" <filia@softhome.net>
To: root@chaos.analogic.com
Cc: Jaco Kroon <jkroon@cs.up.ac.za>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: stack allocation and gcc
Date: Wed, 10 Mar 2004 16:05:05 +0100	[thread overview]
Message-ID: <404F2EA1.8030702@softhome.net> (raw)
In-Reply-To: <Pine.LNX.4.53.0403100806570.15421@chaos>

Richard B. Johnson wrote:
> The caller expects that the space for the second set of local
> variables in the second program unit is not allocated until the
> program unit is entered.
> 
> I don't know why he would expect this behavior. Certainly

    It was my first thought actually - when I have started typeing in 
e-mail.

    When I have reached half e-mail - I have understood that this is 
simple performance consideration - stack space is allocated once.

    I have tryed to convert my e-mail to another issue - but seems I did 
it not good enough :-)

    But then I realized that my thinking was wrong - I'm using variables 
in different never overlapping contextes. But space allocated for 
everyone. "if (..) { int i; }; if (...) { int i; }" will result not in 
sizeof(int) stack space allocated - but in sizeof(int)*2.

    It seems that gcc check size required by all top level contextes in 
function - it checks for "if { int a[16] } else { int a[16] }" - space 
allocated correctly.
    But 'if () { int a[16]; }; if () { int a[16] };' seems to break 
something, and sum of the sizes for both if()'s spaces finishes 
allocated on stack. And this was the case with macro in my module.

    I doubt I can write competent report/query to gcc mail list - 
probably it is worth to ask there.

-- 
Ihar 'Philips' Filipau  / with best regards from Saarbruecken.
--                                                           _ _ _
  "... and for $64000 question, could you get yourself       |_|*|_|
    vaguely familiar with the notion of on-topic posting?"   |_|_|*|
                                 -- Al Viro @ LKML           |*|*|*|

  reply	other threads:[~2004-03-10 15:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10 12:27 stack allocation and gcc Ihar 'Philips' Filipau
2004-03-10 12:55 ` Jaco Kroon
2004-03-10 13:15   ` Bart Hartgers
2004-03-10 13:21   ` Richard B. Johnson
2004-03-10 15:05     ` Ihar 'Philips' Filipau [this message]
2004-03-11  6:04       ` IBM Thinkpad with docking station Frank Fiene
2004-03-10 14:25   ` stack allocation and gcc Ihar 'Philips' Filipau
     [not found] ` <200403101344.37171.baldrick@free.fr>
2004-03-10 14:06   ` Ihar 'Philips' Filipau

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=404F2EA1.8030702@softhome.net \
    --to=filia@softhome.net \
    --cc=jkroon@cs.up.ac.za \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    /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: link
Be 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