<div dir="ltr">Hi :)<br><br>I am seeing faulty pattern matching in Erlang apps compiled to R12B-3<br>with +native, on 64-bit. Applies to older versions as well<br><br>More specificially this happens in Mochiweb in mochiweb_http.erl:request/2<br>
Here is the code:<br><br>request(Socket, Body) -><br>    case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of<br>        {ok, {http_request, Method, Path, Version}} -><br>           <br>headers(Socket, {Method, Path, Version}, [], Body);<br>
        {error, {http_error, "\r\n"}} -><br>           <br>request(Socket, Body);<br>        {error, {http_error, "\n"}} -><br>           <br>request(Socket, Body);<br>        _Other -><br>           <br>
io:format("~nOther = ~p~n", [_Other]),   %my debug line<br>           <br>gen_tcp:close(Socket),<br>            exit(normal)<br>    end.<br><br>I put debugline under the default condition, to see what the case was.<br>
Oddly enough it gave me this output:<br><br>Other = {ok,{http_request,'GET',{abs_path,"/"},{1,1}}}<br><br>which is a perfect match for the first condition.<br>...And It matches up just fine, if not compiled with +native<br>
<br>I also tried replacing the {http_request,Method,Path,Version} pattern with _Message, and that gave a successful a match. _Message contained the same as Other (without the 'ok')<br><br>To reproduce: grab Mochiweb source code (r84 of this writing), append<br>
+native to ERLC_FLAGS in support/<a href="http://include.mk">include.mk</a>. Execute<br>`scripts/new_mochiweb.erl foo` to get skeleton files, and append<br>+native to foo/support/<a href="http://include.mk">include.mk</a>. here as well.<br>
make,  and ./start-dev.sh<br><br>Regards,<br>Kris<br></div>