This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/81445] Dynamic stack allocation not optimized into static allocation
- From: "wilco at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Jul 2017 18:11:05 +0000
- Subject: [Bug middle-end/81445] Dynamic stack allocation not optimized into static allocation
- Auto-submitted: auto-generated
- References: <bug-81445-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81445
--- Comment #5 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #4)
> (In reply to Wilco from comment #2)
> > I don't see it happen for the simplest case in current trunk:
>
> 400 bytes is too large, try again with something smaller. (I'm with you if
> you want to increase the threshold)
I see, it appears 256 bytes is the maximum, that's a bit low indeed. Note it
will statically allocate 100 arrays of 256 bytes but not 1 array of 25600
bytes...
Also it doesn't support these simple cases:
void vla2(int x)
{
if (x == 10)
{
int arr[x];
t (arr);
}
}
void vla3(int x)
{
if (x >= 0 && x <= 10)
{
int arr[x];
t (arr);
}
}