[erlang-questions] Inlining Restrictions

David Mercer dmercer@REDACTED
Fri Nov 21 20:58:47 CET 2008


Having stripped the whole thing down to a minimal example, the problem
appears to be with using functions in guards.  Here's my minimal example:

----------------------------------------------------------------------
-module(inline_test).
-compile(inline).
-export([exported_fun/0]).

exported_fun() -> fun_with_guard(fun used_in_guard/0).

fun_with_guard(GuardedFun) when is_function(GuardedFun) -> x.

used_in_guard() -> x.
----------------------------------------------------------------------

> -----Original Message-----
> From: Richard Carlsson [mailto:richardc@REDACTED]
> Sent: Friday, November 21, 2008 12:20
> To: dmercer@REDACTED
> Cc: 'Erlang Questions'
> Subject: Re: [erlang-questions] Inlining Restrictions
> 
> David Mercer wrote:
> > Are there any restrictions on when it is legal to do function inlining
> > (with either the -compile(inline) directive or the compiler option)?
> > Reason I ask is that I have code that compiles fine without inlining but
> > crashes with an "internal error in kernel_module" error when I enable
> > inlining.  Am wondering if I could refactor my code and take out the
> > offending statement and so allow function inlining.  Please advise.
> > Thank-you.
> 
> If possible, please send me your code (or even better, a minimal
> example that displays this bug) so I can have a look. Inlining is
> supposed to work without any need for tweaking.
> 
>      /Richard




More information about the erlang-questions mailing list