Refuse to load "literals" that can be confused with registers
Refuse to load "literals" that can be confused with registers

The 's' operand overloads the tags for pids and ports to represent
X and Y registers, respectively.  At load time, refuse to load the
module if the "literal" term is not a pid or port, as it would be
interpreted as a register.

This does not happen with normally compiled code, but it can happen
if the compiler (or beam_asm) is abused like in the following example:

make_bad() ->
    Pid = self(),
    Forms = [{attribute, 0, module, bad_s_operand},
             {attribute, 0, export, [{test, 0}]},
             {function, 0, test, 0,
              [{clause, 0, [], [],
                [{call,0,{atom,0,tuple_size},[{integer, 0, Pid}]}]}]}],
    {ok, Module, Bin} = compile:forms(Forms, [no_copt,no_postopt,report_errors]),
    code:load_binary(Module, "bad_s_operand.erl", Bin).

With this commit applied, the following message will be printed
when make_bad() is run:

=ERROR REPORT==== 10-Nov-2017::14:47:59 ===
Loading of bad_s_operand.erl failed: badfile

=ERROR REPORT==== 10-Nov-2017::14:47:59 ===
beam/beam_load.c(2396): Error loading function bad_s_operand:test/0: op bif1_body: bsd:
  the term '<0.60.0>' would be confused with a register

saleyn/otp,rlipscombe/otp,dumbbell/otp,ferd/otp,saleyn/otp,dgud/otp,RaimoNiskanen/otp,cobusc/otp,erlang/otp,dgud/otp,vinoski/otp,electricimp/otp,electricimp/otp,potatosalad/otp,tuncer/otp,getong/otp,g-andrade/otp,bsmr-erlang/otp,emacsmirror/erlang,bjorng/otp,RoadRunnr/otp,legoscia/otp,lrascao/otp,ferd/otp,bjorng/otp,potatosalad/otp,bsmr-erlang/otp,saleyn/otp,g-andrade/otp,cobusc/otp,ferd/otp,aboroska/otp,bsmr-erlang/otp,jj1bdx/otp,kvakvs/otp,lrascao/otp,aboroska/otp,cobusc/otp,getong/otp,emacsmirror/erlang,jj1bdx/otp,RoadRunnr/otp,kvakvs/otp,rlipscombe/otp,vladdu/otp,ferd/otp,lrascao/otp,jj1bdx/otp,dumbbell/otp,bsmr-erlang/otp,aboroska/otp,RoadRunnr/otp,tuncer/otp,RoadRunnr/otp,saleyn/otp,dumbbell/otp,uabboli/otp,mikpe/otp,mikpe/otp,rlipscombe/otp,bjorng/otp,electricimp/otp,vinoski/otp,dumbbell/otp,lrascao/otp,lrascao/otp,jj1bdx/otp,tuncer/otp,uabboli/otp,g-andrade/otp,g-andrade/otp,vladdu/otp,RaimoNiskanen/otp,saleyn/otp,RaimoNiskanen/otp,ferd/otp,cobusc/otp,RoadRunnr/otp,vinoski/otp,RaimoNiskanen/otp,dumbbell/otp,potatosalad/otp,aboroska/otp,potatosalad/otp,getong/otp,erlang/otp,saleyn/otp,fenollp/otp,getong/otp,g-andrade/otp,potatosalad/otp,ferd/otp,kvakvs/otp,bsmr-erlang/otp,isvilen/otp,lrascao/otp,aboroska/otp,vinoski/otp,bjorng/otp,mikpe/otp,kvakvs/otp,emacsmirror/erlang,electricimp/otp,getong/otp,emacsmirror/erlang,erlang/otp,potatosalad/otp,electricimp/otp,legoscia/otp,ferd/otp,dgud/otp,bjorng/otp,RoadRunnr/otp,saleyn/otp,fenollp/otp,isvilen/otp,vladdu/otp,isvilen/otp,aboroska/otp,vladdu/otp,potatosalad/otp,RoadRunnr/otp,vinoski/otp,RaimoNiskanen/otp,ferd/otp,vinoski/otp,vladdu/otp,RaimoNiskanen/otp,emacsmirror/erlang,emacsmirror/erlang,aboroska/otp,uabboli/otp,legoscia/otp,kvakvs/otp,jj1bdx/otp,lrascao/otp,jj1bdx/otp,potatosalad/otp,dumbbell/otp,jj1bdx/otp,g-andrade/otp,rlipscombe/otp,dgud/otp,isvilen/otp,getong/otp,cobusc/otp,kvakvs/otp,tuncer/otp,vinoski/otp,cobusc/otp,potatosalad/otp,isvilen/otp,vladdu/otp,emacsmirror/erlang,fenollp/otp,vinoski/otp,vladdu/otp,rlipscombe/otp,bjorng/otp,dgud/otp,getong/otp,fenollp/otp,legoscia/otp,erlang/otp,electricimp/otp,electricimp/otp,vladdu/otp,erlang/otp,lrascao/otp,erlang/otp,dgud/otp,RaimoNiskanen/otp,bsmr-erlang/otp,bsmr-erlang/otp,g-andrade/otp,electricimp/otp,lrascao/otp,emacsmirror/erlang,bjorng/otp,ferd/otp,tuncer/otp,mikpe/otp,jj1bdx/otp,fenollp/otp,vinoski/otp,mikpe/otp,rlipscombe/otp,bjorng/otp,dgud/otp,uabboli/otp,g-andrade/otp,dumbbell/otp,dumbbell/otp,tuncer/otp,fenollp/otp,kvakvs/otp,erlang/otp,RoadRunnr/otp,isvilen/otp,isvilen/otp,fenollp/otp,tuncer/otp,electricimp/otp,rlipscombe/otp,getong/otp,aboroska/otp,uabboli/otp,bsmr-erlang/otp,legoscia/otp,getong/otp,RaimoNiskanen/otp,bsmr-erlang/otp,uabboli/otp,getong/otp,jj1bdx/otp,g-andrade/otp,isvilen/otp,kvakvs/otp,dumbbell/otp,erlang/otp,erlang/otp,kvakvs/otp,rlipscombe/otp,rlipscombe/otp,legoscia/otp,jj1bdx/otp,g-andrade/otp,RoadRunnr/otp,legoscia/otp,dgud/otp,RaimoNiskanen/otp,vladdu/otp,fenollp/otp,isvilen/otp,uabboli/otp,mikpe/otp,saleyn/otp,uabboli/otp,dgud/otp,tuncer/otp,legoscia/otp,rlipscombe/otp,mikpe/otp,fenollp/otp,potatosalad/otp,legoscia/otp,uabboli/otp,dumbbell/otp,aboroska/otp,dgud/otp,emacsmirror/erlang,tuncer/otp,erlang/otp,cobusc/otp,bjorng/otp,mikpe/otp,emacsmirror/erlang,vinoski/otp,isvilen/otp,mikpe/otp,cobusc/otp,bjorng/otp,mikpe/otp,saleyn/otp