[patch] Jungerl/iBrowse compiler error workaround

Steve ssmith@REDACTED
Sat Jun 10 05:42:51 CEST 2006


Hi,

I need to apply the following patch to the current jungerl CVS version
of iBrowse due to what appears to be a compiler error in erlang versions
prior to R11B:

----------------

diff -Nurw jungerl.orig/lib/ibrowse/src/ibrowse_http_client.erl jungerl/lib/ibrowse/src/ibrowse_http_client.erl
--- jungerl.orig/lib/ibrowse/src/ibrowse_http_client.erl        2006-06-01 08:02:06.000000000 +1000
+++ jungerl/lib/ibrowse/src/ibrowse_http_client.erl     2006-06-10 13:30:15.000000000 +1000
@@ -587,7 +587,7 @@
 chunk_request_body(Body, ChunkSize) ->
     chunk_request_body(Body, ChunkSize, []).

-chunk_request_body(Body, _ChunkSize, Acc) when Body == <<>>; Body == [] ->
+chunk_request_body(Body, _ChunkSize, Acc) when Body == []; Body == <<>> ->
     LastChunk = "0\r\n",
     lists:reverse(["\r\n", LastChunk | Acc]);
 chunk_request_body(Body, ChunkSize, Acc) when binary(Body),

----------------

The compiler problem can be reproduced with the following fragment:

        -module(test).
        
        -export([works/1, fails/1]).
        
        works(Body) when Body == []; Body == <<>> ->
            [].
        
        fails(Body) when Body == <<>>; Body == [] ->
            [].

which produces the following:

        Function fails/1 refers to undefined label 11
        ./test.erl:none: internal error in beam_dead;
        crash reason: {{case_clause,{'EXIT',{undefined_label,11}}},
                       [{compile,'-select_passes/2-anonymous-2-',2},
                        {compile,'-internal_comp/4-anonymous-1-',2},
                        {compile,fold_comp,3},
                        {compile,internal_comp,4},
                        {compile,internal,3}]}

I can reproduce this with erlang versions R10B-7 (Dapper) and R10B-9
(Debian unstable), but it doesn't occur with a manual build of R11B.

Cheers,
Steve





More information about the erlang-questions mailing list