lkml.org 
[lkml]   [2004]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: stack allocation and gcc
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 |*|*|*|
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.450 / U:24.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site