[erlang-bugs] Internal error in sys_core_fold when matching on map is guaranteed to fail

Anthony Ramine n.oxyde@REDACTED
Sun Mar 23 12:29:58 CET 2014


https://github.com/erlang/otp/pull/306

-- 
Anthony Ramine

Le 18 mars 2014 à 21:45, Björn-Egil Dahlberg <wallentin.dahlberg@REDACTED> a écrit :

> In the future Maps should be considered as data but since it seemed like I needed a crowbar and some soap to whack it into the cerl opt structure "nicely" I decided against it for now, fearing more destruction than gains .. also I wanted literals in the master branch. =) The omission of maps as data will currently omit some core optimizations .. which is also totally ok .. for now.
> 
> is_data(#c_literal{val=V}) when not is_map(V) ->
>     true;
> 
> Looks reasonable to me at this point. Give me a shout if you see/find any flaws with this plan.
> 
> // Björn-Egil
> 
> 
> 2014-03-18 19:58 GMT+01:00 Anthony Ramine <n.oxyde@REDACTED>:
> Hello,
> 
> Are map literals supposed to be considered data, as per cerl:is_data/1? can I currently fix this by changing
> 
> is_data(#c_literal{}) ->
>     true;
> 
> to
> 
> is_data(#c_literal{val=V}) when not is_map(V) ->
>     true;
> 
> or not?
> 
> Regards,
> 
> --
> Anthony Ramine
> 
> Le 18 mars 2014 à 18:53, Anthony Ramine <n.oxyde@REDACTED> a écrit :
> 
> > Cool, will look at it.
> >
> > --
> > Anthony Ramine
> >
> > Le 18 mars 2014 à 17:50, Ulf Norell <ulf.norell@REDACTED> a écrit :
> >
> >> That fixed the case when the map doesn't match but I get the same error when it's the map that matches and other patterns that don't:
> >>
> >> -module(bug).
> >> f() ->
> >>  case #{} of
> >>    #{} -> 0;
> >>    a   -> 1
> >>  end.
> >>
> >> This is on master from today (aab1afa8a63081f2c30f83ebe8b6caaac979795c).
> >>
> >> / Ulf
> >>
> >>
> >> On Tue, Mar 4, 2014 at 11:38 PM, Anthony Ramine <n.oxyde@REDACTED> wrote:
> >> https://github.com/erlang/otp/pull/267
> >>
> >> --
> >> Anthony Ramine
> >>
> >> Le 4 mars 2014 à 09:45, Ulf Norell <ulf.norell@REDACTED> a écrit :
> >>
> >>> This one crashes in a different place but likely for the same reason.
> >>>
> >>> -module(bug).
> >>> f() ->
> >>>  case true of
> >>>    #{}  -> error;
> >>>    true -> ok
> >>>  end.
> >>>
> >>> $ erl
> >>> Erlang/OTP 17 [RELEASE CANDIDATE 2] [erts-6.0] [source-a74e66a] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
> >>>
> >>> Eshell V6.0  (abort with ^G)
> >>> 1> c(bug).
> >>> Function: f/0
> >>> bug.erl: internal error in core_fold_module;
> >>> crash reason: function_clause
> >>>
> >>>  in function  sys_core_fold:opt_bool_clauses/3
> >>>     called as sys_core_fold:opt_bool_clauses([],true,false)
> >>>  in call from sys_core_fold:opt_bool_clauses/3 (sys_core_fold.erl, line 1815)
> >>>  in call from sys_core_fold:opt_bool_clauses/1 (sys_core_fold.erl, line 1790)
> >>>  in call from sys_core_fold:opt_bool_case/1 (sys_core_fold.erl, line 1779)
> >>>  in call from sys_core_fold:expr/3 (sys_core_fold.erl, line 347)
> >>>  in call from sys_core_fold:opt_simple_let_1/4 (sys_core_fold.erl, line 2562)
> >>>  in call from sys_core_fold:expr/3 (sys_core_fold.erl, line 355)
> >>>  in call from sys_core_fold:expr/3 (sys_core_fold.erl, line 279)
> >>> bug.erl:2: Warning: function f/0 is unused
> >>> error
> >>>
> >>> / Ulf
> >>>
> >>>
> >>>
> >>> On Tue, Mar 4, 2014 at 9:42 AM, Ulf Norell <ulf.norell@REDACTED> wrote:
> >>> -module(bug).
> >>> f() ->
> >>>  case maybe_map of
> >>>    #{}     -> ok;
> >>>    not_map -> error
> >>>  end.
> >>>
> >>> $ erl
> >>> Erlang/OTP 17 [RELEASE CANDIDATE 2] [erts-6.0] [source-a74e66a] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
> >>>
> >>> Eshell V6.0  (abort with ^G)
> >>> 1> c(bug).
> >>> Function: f/0
> >>> bug.erl: internal error in core_fold_module;
> >>> crash reason: {case_clause,{none}}
> >>>
> >>>  in function  sys_core_fold:will_match/2 (sys_core_fold.erl, line 1748)
> >>>  in call from sys_core_fold:clauses/5 (sys_core_fold.erl, line 1701)
> >>>  in call from sys_core_fold:clauses/5 (sys_core_fold.erl, line 1718)
> >>>  in call from sys_core_fold:expr/3 (sys_core_fold.erl, line 352)
> >>>  in call from sys_core_fold:clause/4 (sys_core_fold.erl, line 1481)
> >>>  in call from sys_core_fold:clauses/5 (sys_core_fold.erl, line 1699)
> >>>  in call from sys_core_fold:expr/3 (sys_core_fold.erl, line 352)
> >>>  in call from sys_core_fold:expr/3 (sys_core_fold.erl, line 279)
> >>> bug.erl:2: Warning: function f/0 is unused
> >>> error
> >>>
> >>> / Ulf
> >>>
> >>>
> >>> _______________________________________________
> >>> erlang-bugs mailing list
> >>> erlang-bugs@REDACTED
> >>> http://erlang.org/mailman/listinfo/erlang-bugs
> >>
> >> _______________________________________________
> >> erlang-bugs mailing list
> >> erlang-bugs@REDACTED
> >> http://erlang.org/mailman/listinfo/erlang-bugs
> >>
> >
> 
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
> 




More information about the erlang-bugs mailing list