{"push_id":775779215,"size":1,"distinct_size":1,"ref":"refs/heads/egil/fix-compiler-map-register","head":"706660ad7b4372c03945811e531531385059bfd7","before":"ab31609a33717fec73201cb40c4331f92c107c45","commits":[{"sha":"706660ad7b4372c03945811e531531385059bfd7","author":{"email":"c9757e9abb1c7a7a360eb0d16c19fbec1d0557c1@erlang.org","name":"Björn-Egil Dahlberg"},"message":"compiler: Fix get_map_elements register corruption\n\nInstruction get_map_elements might destroys target registers when fail-label is taken.\nOnly seen with patterns with two, and only two, target registers.\nSpecifically: we copy one register, and then jump.\n\n    foo(A,#{a := V1, b := V2}) -> ...\n    foo(A,#{b := V}) -> ...\n\ncall foo(value, #{a=>whops, c=42}).\n\ncorresponding assembler:\n\n    {test,is_map,{f,5},[{x,1}]}.\n\n    {get_map_elements,{f,7},{x,1},{list,[{atom,a},{x,1},{atom,b},{x,2}]}}.\n    %% if 'a' exists but not 'b' {x,1} is overwritten, jump {f,7}\n\n    {move,{integer,1},{x,0}}.\n    {call_only,3,{f,10}}.\n    {label,7}.\n    {get_map_elements,{f,8},{x,1},{list,[{atom,b},{x,2}]}}.\n    %% {x,1} (src) is now corrupt\n\n    {move,{x,0},{x,1}}.\n    {move,{integer,2},{x,0}}.\n    {call_only,3,{f,10}}.\n\nThe fix is to remove 'opt_moves' pass for the get_map_elements instruction\nin the case of two or more destinations.\n\nReported-by: Valery Tikhonov","distinct":true,"url":"https://api.github.com/repos/psyeugenic/otp/commits/706660ad7b4372c03945811e531531385059bfd7"}]}