Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
6779c87f
Commit
6779c87f
authored
Apr 10, 2008
by
Michael Beck
Browse files
disable inline of functions which call alloca(), causes stack overrun in 176.gcc
[r19226]
parent
6b0ac742
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/opt/opt_inline.c
View file @
6779c87f
...
...
@@ -753,6 +753,22 @@ static void find_addr(ir_node *node, void *env) {
is_Start
(
get_Proj_pred
(
node
))
&&
get_Proj_proj
(
node
)
==
pn_Start_P_value_arg_base
)
{
*
allow_inline
=
0
;
}
else
if
(
is_Alloc
(
node
)
&&
get_Alloc_where
(
node
)
==
stack_alloc
)
{
/* From GCC:
* Refuse to inline alloca call unless user explicitly forced so as this
* may change program's memory overhead drastically when the function
* using alloca is called in loop. In GCC present in SPEC2000 inlining
* into schedule_block cause it to require 2GB of ram instead of 256MB.
*
* Sorryly this is true with our implementation also.
* Moreover, we cannot differentiate between alloca() and VLA yet, so this
* disables inlining of functions using VLA (with are completely save).
*
* 2 Solutions:
* - add a flag to the Alloc node for "real" alloca() calls
* - add a new Stack-Restore node at the end of a function using alloca()
*/
*
allow_inline
=
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment