[erlang-bugs] Lengthy subfunctions in Core Erlang code crash the compiler if inlining is turned on

Rene Kijewski <>
Mon Oct 10 22:49:26 CEST 2011


Hello,

(I first asked this question in Stackoverflow but was hinted that this ML
is a better place for such questions.)

I wanted to test the inlining capabilities of the compiler and wrote a
method containing three lengthy subfunctions. (See attachment.)

Compiling it without a 'inline' flag works as expected but supplying it
renders a crash:

> $ erlc +verbose +from_core +inline lengthySubfun.core
> Inlining: inline_size=24 inline_effort=150
> Function: test/6
> ./lengthySubfun.core:none: internal error in core_dsetel_module;
> crash reason: {{badmatch,error},
>                [{sys_core_dsetel,visit,2},
>                 {lists,mapfoldl,3},
>                 {sys_core_dsetel,visit,2},
>                 {sys_core_dsetel,visit,2},
>                 {sys_core_dsetel,visit,2},
>                 {sys_core_dsetel,visit,2},
>                 {sys_core_dsetel,'-visit_def_list/2-anonymous-0-',2},
>                 {lists,mapfoldl,3}]}

unless I specify an insanely high value in range of 10 000 for both
inline_effort and inline_size.

The method can be called like that:
> lengthySubfun:test(fun () -> 1 end, fun () -> 2 end, fun (X) -> X end,
> fun (X) -> X end, fun () -> true end, fun (X) -> X end).

My Erlang/OTP version is:
> Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2]
> [async-threads:0] [hipe] [kernel-poll:false]

Compiled from:
> 68c96ca855821adb42a25ced5b69446ae7ccc635

Best regards
René

-- 
()  ascii ribbon campaign - against HTML e-mail
/\  www.asciiribbon.org   - against proprietary attachments
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lengthySubfun.core
Type: application/x-core
Size: 33895 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20111010/7d39fb7e/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20111010/7d39fb7e/attachment-0003.bin>


More information about the erlang-bugs mailing list