PATCH: R13B01: new() function with module parameter variable(s) in guard crashes compiler

View: New views
3 Messages — Rating Filter:   Alert me  

PATCH: R13B01: new() function with module parameter variable(s) in guard crashes compiler

by Yurii Rashkovskii :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.







________________________________________________________________
erlang-patches mailing list. See http://www.erlang.org/faq.html
erlang-patches (at) erlang.org

compiler-new-guards-use-of-parameters.diff (951 bytes) Download Attachment

Re: PATCH: R13B01: new() function with module parameter variable(s) in guard crashes compiler

by Yurii Rashkovskii :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello again,

In my previous message I included a patch that goes in a reverse  
direction. Please find proper version attached.






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

compiler-new-guards-use-of-parameters.diff (951 bytes) Download Attachment

Re: PATCH: R13B01: new() function with module parameter variable(s) in guard crashes compiler

by Yurii Rashkovskii :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello again :)

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






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



________________________________________________________________
erlang-patches mailing list. See http://www.erlang.org/faq.html
erlang-patches (at) erlang.org

compiler-new-guards-use-of-parameters.diff (983 bytes) Download Attachment