Bug in hipe?

Per Gustafsson <>
Thu Apr 14 15:26:05 CEST 2005


There is a limit on how big binaries can be to work with the bit syntax. 
On a 32 bit machine the bit syntax only works for binaries which are 
smaller than 512 MB (4GBit). When bigger binaries are used the behaviour 
is alittle bit weird. For example in this program:

-module(bug).

-export([start/0]).

start() ->
        {ok, B} = file:read_file("tmp_file4"),
  io:format("Halfway: Size:~w~n", [size(B)]),
    <<Start:15/binary,Rem/binary>> = B,
  {Start,size(Rem)}.

Gives the following result:

bug:start().
Halfway: Size:671088635
{<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,134217708}

When tmp_file4 is 671088635 byte file of all zeroes.

The result ought to be:
bug:start().
Halfway: Size:671088635
{<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,671088620}

or possible some error message.

Per Gustafsson

>> Hi,
>>
>> When working with very big binaries (something like 256MB) the bit
>> syntax seems to fail when compiling with hipe:
>>
>> -module(foo).
>>
>> -export([start/0]).
>>
>> start() ->
>>        {ok, B} = file:read_file("256Mb_File"),
>>     <<Start:1500/binary,Rem/binary>> = B.
>>
>> Compiling this with beam works, but with hipe it fails during
>> execution with the following error:
>>
>> 1> foo:start().
>> ** 
>> exited:{{badmatch,<<97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,...>>}, 
>>
>>           []} **
>>
>> =ERROR REPORT==== 14-Apr-2005::13:59:28 ===
>> Error in process <0.30.0> with exit value: {{badmatch,<<268435456 
>> bytes>>},[]}
>>
>> Is this a known bug or limitation when working with binaries and hipe?
>>
>> Regards.
>>
>>  
>>
>




More information about the erlang-questions mailing list