public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60660] New: alloca function for inlines that allocates on caller stack
@ 2014-03-25 18:58 josh at joshtriplett dot org
2014-03-25 19:00 ` [Bug c/60660] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: josh at joshtriplett dot org @ 2014-03-25 18:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60660
Bug ID: 60660
Summary: alloca function for inlines that allocates on caller
stack
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: josh at joshtriplett dot org
To implement certain helper functions, it would help greatly to have the
ability to perform stack allocations in the parent function from an inline
function. If the function is guaranteed to be inline (for instance, with
always_inline), this seems straightforward. A function like
__builtin_alloca_caller() would make it possible to write something like
alloca_sprintf safely, without multiple evaluation of the variable arguments as
a macro would.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/60660] alloca function for inlines that allocates on caller stack
2014-03-25 18:58 [Bug c/60660] New: alloca function for inlines that allocates on caller stack josh at joshtriplett dot org
@ 2014-03-25 19:00 ` pinskia at gcc dot gnu.org
2014-03-25 19:01 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-03-25 19:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60660
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is much harder than you think really. since you have to move all the
arguments of the callee function
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/60660] alloca function for inlines that allocates on caller stack
2014-03-25 18:58 [Bug c/60660] New: alloca function for inlines that allocates on caller stack josh at joshtriplett dot org
2014-03-25 19:00 ` [Bug c/60660] " pinskia at gcc dot gnu.org
@ 2014-03-25 19:01 ` pinskia at gcc dot gnu.org
2014-03-25 21:33 ` mpolacek at gcc dot gnu.org
2014-03-25 22:50 ` josh at joshtriplett dot org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-03-25 19:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60660
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>without multiple evaluation of the variable arguments as a macro would.
You can use statement expressions with typeof extension to get around the issue
of multiple evaluation issue of macros already.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/60660] alloca function for inlines that allocates on caller stack
2014-03-25 18:58 [Bug c/60660] New: alloca function for inlines that allocates on caller stack josh at joshtriplett dot org
2014-03-25 19:00 ` [Bug c/60660] " pinskia at gcc dot gnu.org
2014-03-25 19:01 ` pinskia at gcc dot gnu.org
@ 2014-03-25 21:33 ` mpolacek at gcc dot gnu.org
2014-03-25 22:50 ` josh at joshtriplett dot org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-03-25 21:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60660
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Note that even functions marked as always_inline might not be in fact
inlineable.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/60660] alloca function for inlines that allocates on caller stack
2014-03-25 18:58 [Bug c/60660] New: alloca function for inlines that allocates on caller stack josh at joshtriplett dot org
` (2 preceding siblings ...)
2014-03-25 21:33 ` mpolacek at gcc dot gnu.org
@ 2014-03-25 22:50 ` josh at joshtriplett dot org
3 siblings, 0 replies; 5+ messages in thread
From: josh at joshtriplett dot org @ 2014-03-25 22:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60660
--- Comment #4 from Josh Triplett <josh at joshtriplett dot org> ---
(In reply to Andrew Pinski from comment #1)
> This is much harder than you think really. since you have to move all the
> arguments of the callee function
That I'm aware of, but it should be less of an issue with an always inline
function, where you shouldn't necessarily be passing stack arguments in the
first place.
(In reply to Andrew Pinski from comment #2)
> >without multiple evaluation of the variable arguments as a macro would.
>
> You can use statement expressions with typeof extension to get around the
> issue of multiple evaluation issue of macros already.
Not with a variable argument list, due to limitations in the C preprocessor.
(In reply to Marek Polacek from comment #3)
> Note that even functions marked as always_inline might not be in fact
> inlineable.
This seems like exactly the same limitation that __builtin_va_arg_pack has.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-03-25 22:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-25 18:58 [Bug c/60660] New: alloca function for inlines that allocates on caller stack josh at joshtriplett dot org
2014-03-25 19:00 ` [Bug c/60660] " pinskia at gcc dot gnu.org
2014-03-25 19:01 ` pinskia at gcc dot gnu.org
2014-03-25 21:33 ` mpolacek at gcc dot gnu.org
2014-03-25 22:50 ` josh at joshtriplett dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).