[erlang-patches] PATCH: R13B01: new() function with module parameter variable(s) in guard crashes compiler

Yurii Rashkovskii yrashk@REDACTED
Mon Aug 17 18:37:18 CEST 2009


Hello again :)

I am very sorry, but I found a bug in my patch. You can find new patch  
attached.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: compiler-new-guards-use-of-parameters.diff
Type: application/octet-stream
Size: 962 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20090817/b767c1e6/attachment.obj>
-------------- next part --------------



On 17-Aug-09, at 6:51 AM, Yurii Rashkovskii wrote:

> Hello again,
>
> In my previous message I included a patch that goes in a reverse  
> direction. Please find proper version attached.
>
> <compiler-new-guards-use-of-parameters.diff>
>
>
> Yurii.
> 	
> On 17-Aug-09, at 6:36 AM, Yurii Rashkovskii wrote:
>
>> Hello,
>>
>> Currently, R13B01's compiler crashes on source code like this:
>>
>> -module(somemodule,[P1]).
>> -compile(export_all).
>>
>> new() when P1 > 0 ->
>>   instance(hello).
>>
>> The crash looks like this:
>>
>> ./somemodule.erl: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},
>>               {lists,mapfoldl,3},
>>               {sys_core_dsetel,visit,2},
>>               {sys_core_dsetel,visit,2},
>>               {sys_core_dsetel,visit_module_1,3}]}
>>
>> Attached you can find a quick patch that makes compiler emit an  
>> error instead:
>>
>> ./somemodule.erl:4: variable 'P1' is unbound
>>
>> This patch is also available through this branch: http://github.com/yrashk/erlang/commits/compiler-new-guards-use-of-parameters
>>
>> The solution in this patch might not be ideal, but it is a start;  
>> if OTP team will be interested in including it into official source  
>> code tree, I will be happy to spend a little bit more time to make  
>> it somewhat nicer.
>>
>> Thanks,
>> Yurii.
>>
>> <compiler-new-guards-use-of-parameters.diff>
>>
>>
>> ________________________________________________________________
>> erlang-patches mailing list. See http://www.erlang.org/faq.html
>> erlang-patches (at) erlang.org
>
>
>
> ________________________________________________________________
> erlang-patches mailing list. See http://www.erlang.org/faq.html
> erlang-patches (at) erlang.org



More information about the erlang-patches mailing list