stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Black <abl...@roguewave.com>
Subject Re: [patch]Re: examples in OUTPUT state
Date Mon, 07 Aug 2006 21:32:39 GMT
Sorry about forgetting that.  I've been somewhat focused on the windows 
port today.

2006-08-07    Andrew Black  <ablack@roguewave.com>
	* output.cpp (check_example): Initialize read buffers prior to read to 
prevent incorrect results

Martin Sebor wrote:
> Andrew Black wrote:
>> Greetings all.
>>
>> Attached is a short patch that should resolve this issue.
> 
> Yup, looks good, thanks!
> 
> Can you please post a ChangeLog to go with your change so I can
> commit it?
> 
> Thanks again!
> Martin
> 
>>
>> The cause of the error was that the output was smaller than the static 
>> holding buffer, so the call to memcmp was comparing beyond the amount 
>> of data that had been read into the buffer.  This in turn was leading 
>> to a difference in the unfilled portions of the buffer.  This 
>> difference was caused by the natural variations in uninitialized memory.
>>
>> --Andrew Black
>>
>> Martin Sebor wrote:
>>
>>> There are a bunch of examples that the exec utility reports as
>>> having failed with the OUTPUT status even though when executed
>>> by hand they run successfully to completion and produce the
>>> expected output. I suspect there must be a bug in the utility.
>>>
>>> $ make auto_ptr run; ./auto_ptr > auto_ptr.out && diff auto_ptr.out

>>> /build/sebor/stdcxx/examples/manual/out/auto_ptr.out; echo $?
>>> make: `auto_ptr' is up to date.
>>> NAME                      STATUS ASSERTS FAILED PERCNT
>>> auto_ptr                  OUTPUT
>>> 0
>>>
>>> Martin
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: output.cpp
>> ===================================================================
>> --- output.cpp    (revision 429465)
>> +++ output.cpp    (working copy)
>> @@ -296,6 +296,10 @@
>>          size_t out_read, ref_read;
>>          int match = 1;
>>  
>> +        /* Zero out holding buffers to avoid false differences */
>> +        memset (out_buf, 0, DELTA_BUF_LEN);
>> +        memset (ref_buf, 0, DELTA_BUF_LEN);
>> +
>>          while (!feof (reference) && !feof (output)) {
>>              /* First, read a block from the files into the buffer */
>>              out_read = fread (out_buf, DELTA_BUF_LEN, 1, output);
> 

Mime
View raw message